@morglod/jsondb
TypeScript icon, indicating that this package has built-in type declarations

0.0.6 • Public • Published

@morglod/jsondb

Super simple file db for cli tools / utils.
It syncs changes from fs & changes from program.

npm i @morglod/jsondb
const counterDB = new JsonDB(
    // path
    'example_counter.json',

    // initial data
    () => ({ counter: 0 })
);

await counterDB.init();

setInterval(() => {
    counterDB.commit(cur => {
        cur.counter++;
    });
}, 1000);

After external update hook

jsobDB.afterRead.push(currentData => {
    // ....
})

Readme

Keywords

none

Package Sidebar

Install

npm i @morglod/jsondb

Weekly Downloads

0

Version

0.0.6

License

MIT

Unpacked Size

5.95 kB

Total Files

4

Last publish

Collaborators

  • morglod