- From: Melvin Carvalho <melvincarvalho@gmail.com>
- Date: Mon, 27 Sep 2021 16:47:42 +0200
- To: public-rww <public-rww@w3.org>
- Message-ID: <CAKaEYhLdVb9dS5CFKDsexCRQO_YaVjDqe3O4GYCscwt1DeeYAA@mail.gmail.com>
I coded up an early alpha version of this https://github.com/rwwcg/rww To use: var json = require('rww')('./test.json') Adding the ('rww') will automatically propagate any changes you make in the JSON back to the file system It's a start, further work would be to make it multi protocol e.g. http+file+others and allow auth with perhaps password I would guess that could be best passed in as an options argument PS I made a RWW Community Group github org, for coders, as we didnt seem to have one @ https://github.com/rwwcg On Sat, 25 Sept 2021 at 15:55, Melvin Carvalho <melvincarvalho@gmail.com> wrote: > i had some feedback on this off-list > > I was pointed two two libraries to edit json config files > > [1] https://github.com/mozilla/node-convict > [2] https://github.com/davidtheclark/cosmiconfig > > also kingsley has suggested > > "the source code of our OSDS doesn't reveal how to write to file:, http:, > or sparql-compliant DBMS targets? " > > > https://chrome.google.com/webstore/detail/openlink-structured-data/egdaiaihbdoiibopledjahjaihbmjhdj > > currently I think a proxy method would be quite compelling for use cases I > have in mind > > the idea would be a simple one, a library with two methods, "read" and > "write" (to a URI) which would work over multiple protocols with various > options (e.g for auth) > > I namespace for this > > https://www.npmjs.com/package/rww > > it should be multi protocol, first of all dealing with http(s): and file: > but more could be added, basically by introspecing on the uri which would > be a passed parameter, then as the data changes, that is propagated to > persistent storage > > lmk (on or off-list) if anyone is interested in scoping out such a library > > > > On Thu, 23 Sept 2021 at 16:11, Melvin Carvalho <melvincarvalho@gmail.com> > wrote: > >> Looking for a simple library here that simply reads and writes to the >> file system >> >> So you import a JSON file >> >> Then you change it and the changes are automatically written to the file >> system >> >> It would be possible to write a simple library to do this, perhaps using >> a JS Proxy [1], but I wonder if anything exists already? >> >> [1] >> https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy >> >
Received on Monday, 27 September 2021 14:48:16 UTC