1.0.1 • Published 2 years ago

littledatabase v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

littledatabase

Little Database is a json based db made for small projects, hence the name "littledatabase"

Getting started:

Install the package with npm:

npm i littledatabase

Now create a new db:

const littledatabase = require("littledatabase");
const db = new littledatabase.db("/path/to/json/file.json"); // make a new db.
// The given json file must have a default. For example: [], {}, or {users:[]}.

db.data[0] = "Hello World"; // Edit the data in json file. It is already parsed.
db.save(); // Save the new data into the json file. It will be stringified.

DB class

  • db.path: path given on construction.
  • db.data: file data. only updates real file when using save method.
  • db.save: method to save data to file.