0.4.0 • Published 4 months ago
fshdb v0.4.0
FshDB
A lightweight & fast json database with the essentials and more
// Require the base db
const DB = require('fshdb');
// Creating the db
let fsh = new DB();
// Setting data
fsh.set('key', 'value');
Constructor
DB(file, options)
file
- Optional, File where the db will be, relative, Default:DB.json
options
- Optionalcompact
- Compact db fileswarm
- Does not store to file, good for cache
Base Functions
set(key, value)
- Sets a value to a key (can be any standard type)get(key)
- Gets the value of a keyhas(key)
- Checks for a key in the db return true or falseremove(key)
- Removes a key from the dbfind(function)
- Returns a list of keys which values follow the functionkeys()
- List of all the keys on the dbvalues()
- List of all the values on the dball()
- Gets the whole database as objectbackup(file)
- Backups the db file to another file (big dbs will take some time)
Number values
Functions for values that are of type number (Values will be converted)
add(key, number)
- Adds the number to the currentsub(key, number)
- Subtracts the number to the current
Array values
Functions for values that are of type array
push(key, value)
- Pushes value into the list elementpull(key, index)
- Removes element at indexpop(key)
- Removes last element (return removed value)flat(key)
- Flattens array at keyconcat(key, value)
- Concats a array to the current one
Object values
Functions for values that are of type object/json
You can add .
inside the keys to denote access of a further object
Example of .
: key.key2
for { key: { key2: 'Hello', key1: 'Bye' } } is 'Hello'
So far this can be used for get and set
0.4.0
4 months ago
1.0.0-beta.3
7 months ago
1.0.0-beta.4
7 months ago
1.0.0-beta.2
10 months ago
1.0.0-beta
1 year ago
0.3.0
1 year ago
0.2.2
1 year ago
0.2.1
1 year ago
0.2.0
1 year ago
0.1.3
1 year ago
0.1.2
1 year ago
0.1.1
1 year ago
0.1.0
1 year ago