2.0.0 • Published 2 years ago

simplest.db v2.0.0

Weekly downloads
6
License
Apache License 2....
Repository
github
Last release
2 years ago

Description

This module allows you to do use really simple key-value databases (stored in JSON or SQLite).

Links

Installation

npm i simplest.db

If you don't want to use the SQLite database

npm i simplest.db --no-optional

If you have any problem in the installation related to better-sqlite3 try running the command as root/administrator or see this

Example

const Database = require('simplest.db').JS0N; // with a zero
// or for sqlite
const Database = require('simplest.db').SQLite;

const db = new Database({
    path: './path/to.file' // .json or .sqlite
});

db.set('foo', 'bar');
db.set('thing.arr', [4, 5, 6]);

/*
{
	foo: 'bar',
	thing: {
		arr: [4, 5, 6]
	}
}
*/

db.get('foo'); // 'bar'
db.get('thing.arr.1'); // 5

db.delete('thing.arr');

/*
{
	foo: 'bar',
	thing: {}
}
*/

db.has('thing.arr'); // false
db.has('foo'); // true

db.clear()
2.0.0

2 years ago

1.0.1-2

3 years ago

1.0.1-1

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago