object-fsify
file system persisted variables as simple as it ever will be with the help of ES6 Proxies magic.
// myAwesomeNodejsScript.jsconst a = a// myArray.json is now '[10]')a// myArray.json is now '[10, 20]')a// myArray.json is now '[10,20,33]') // of course it works the same with objectsconst a = ab = 10// myObject.json is now '{b: 10}')
When you run the script myAwesomeNodejsScript.js
again, all the numbers will be there twice in the array as you would expect-file is loaded up when you initialise the a
variable.
options
async: true // default false, true makes fs operation async indent: 2 // default is none, 2 makes JSON file indents 2 spaces