jsonprovider
v1.0.2
Published
JsonProvider allows you to manage a JSON file simply.
Downloads
3
Readme
JsonProvider
JsonProvider
is a NodeJs library that allows the application developer and library to quickly manage their storage or configuration files.
Documentation
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
}
}
*/
Installation
Install with npm
npm install jsonprovider