Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/scar17off/cryptedjsondb
https://github.com/scar17off/cryptedjsondb
Last synced: 22 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/scar17off/cryptedjsondb
- Owner: scar17off
- License: mit
- Created: 2023-11-18T21:00:57.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-12-17T22:23:24.000Z (about 1 year ago)
- Last Synced: 2024-12-10T20:05:43.134Z (24 days ago)
- Language: JavaScript
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
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
```javascript
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"));
```