1.0.7 • Published 2 years ago
littledb v1.0.7
littledb
littledb
is the littlest key-value database possible based on this
awesome gist.
littledb
consists of simple JavaScript API to put
/get
and ls
to/from database and simple database server.
To run server, simply install package and run
littledb 80 # without passing some available port will be chosen
or in node.js
const port = 80
require('littledb')().listen(port)
Then you can simply access it with curl
:
# save key
curl -d "key;value" localhost
# save array
curl -d "key;value;value;value" localhost
# show keys
curl -d "ls" localhost
# get value
curl -d "key" localhost
# delete key
curl -d "key;" localhost
To create simple client:
const path = './db.json' // this is default path, not required to be passed
const db = require('littledb')(path)
db.put('hello', 'world') // => "world"
db.get('hello') // => "world"
db.ls() // => [ "hello" ]
db.put('hello') // => undefined
db.get('hello') // => undefined