@suni29/jsdb
Version:
JSDB made by Suni29
43 lines (33 loc) • 1.07 kB
Markdown
JSDB is a Databse module for NodeJS made by Suni29, its easy to use & has a lot of features.
Here is some code examples how to use it.
```js
const Database = require('@suni29/jsdb')
const db = new Database('./db.json');
db.set('key', 'value')
db.get('key') // 'value'
db.add('counter', 10)
db.get('counter') // 10
db.substract('counter', 7)
db.get('counter') // 3
db.delete('counter')
db.get('counter') // undefined
db.has('key') // true
db.list() // Returns a stringified JSON text, ex.: "{"key":"value"}"
```
There is not much options currently but in the future I will add more.
```js
const Database = require('@suni29/jsdb')
const db = new Database('./db.json', {
debug: true / false // Turns on or off the debug log in the console.
});
```
The installation process is very easy, just one command.
```bash
$ npm i @suni29/jsdb
```
You can contact me on Discord, Suni29