JsonProvider
is a NodeJs library that allows the application developer and library to quickly manage their storage or configuration files.
const Config = require('jsonprovider');
const config = new Config('./config.json');
config.load();
- Save a value
config.set("Hello", "World!");
config.save();
- Get a value
let result = config.get("Hello");
// Output: World!
- Remove a value
config.remove("Hello");
config.save();
- Get all value
var all = config.getAll();
- Set value with array
config.setNested("Hello", "text", "World!");
config.setNested("Hello", "boolean", true);
config.setNested("Hello", "number", 50);
config.save();
/* Result:
{
"Hello": {
"text": "World!",
"boolean": true,
"number": 50
}
}
*/
- Remove value in array
config.removeNested("Hello", "text");
config.save();
/* Result:
{
"Hello": {
"boolean": true,
"number": 50
}
}
*/
Install with npm
npm install jsonprovider