0.0.0 • Published 6 years ago
json-store-object v0.0.0
json-store-obhect
Simple JSON database to store properties.
npm i --save json-store-objectFirst init the store (make sure that the path is correctly defined):
var JSONStore = require('json-store-object');
var defaultObject = { // Object to consider if the file do not exists
up: false
}
var defaultReturn = null; // Value to return if the key do not exist do not exists
var db = JSONStore(defaultObject, defaultReturn,'./index.json');Functions
db.getAll(): get the whole filedb.get(key, cb): get a property, example:db.get('up' function (err, obj) {...})db.put(key, value, cb): edit a property in the store or create it, example:db.put('up', true, function (err) {...})db.delete(key, cb): delete a property, example:db.delete('up', function (err) {...})
0.0.0
6 years ago