1.0.4 • Published 6 years ago
@devkep/database-json v1.0.4
Json DB
Featherweight writing and reading to json files
Installation
npm i @devkep/database-json --save
Usage
import * as Database from 'jsondb';
var db = new Database("database-name");
// An empty database-name.json will be created
db.push("MyTesting", {hello: "world"});
// Create "MyTesting" key and push an object to it
db.read("MyTesting");
/* =>
{ "hello": "world"}
*/
db.read();
// Read entire file
/* =>
"MyTesting": {
"hello": "world"
}
*/
db.delete("MyTesting");
// Removes your "MyTesting" key
db.truncate();
// Wipes everything
db.unlink();
// Permanently deletes the file
Test
npm run test