Package Exports
- cryptedjsondb
- cryptedjsondb/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (cryptedjsondb) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
CryptedJSONdb
CryptedJSONdb is a module for Node.js that provides an easy and convenient way to open and retrieve JSON data.
It includes methods for setting and discovering by keys and uses secure data encryption with crypto-js encryption.
CryptedJSONdb can store configuration data, update settings, and any other data in JSON format.
Installing
npm install cryptedjsondb
Usage
const CryptedJSONdb = require("cryptedjsondb");
const db = new CryptedJSONdb('./data.json', {
encryption: true,
key: "your secret key",
minify: true
});
// set a value
console.log(db.setValue(1000, 'users', 'scar17off', 'balance')); // returns true if set, returns false if it equals it already
// get a value
const value = db.getValue('users', 'scar17off', 'balance');
console.log(value); // 1000
// add a value to arraylist
db.setValue([], "1");
db.addKeyToArr(1, "1");
console.log(db.getPath("users", "scar17off"));
console.log(db.data);
console.log(db.getItemByIndex(0, "1"));