Socket
Book a DemoInstallSign in
Socket

tinybox

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tinybox

Tiny, single file, scalable key value store based on HAMTs

latest
Source
npmnpm
Version
0.0.0
Version published
Maintainers
1
Created
Source

tinybox

Tiny, single file, scalable key value store based on HAMTs

npm install tinybox

Uses the Hypertrie trie without the replication parts, and auto compacts.

Still under development but the storage format should be stable. Upcoming features include batching, deletions and getting all values out of the store.

Usage

const TinyBox = require('tinybox')

const db = new TinyBox('./db')

db.put('hello', 'world', function () {
  db.get('hello', console.log)
})

API

db = new TinyBox(storage)

Create a new tiny store. Storage can be any (random-access-storage](https://github.com/random-access-storage) instance. For conveinience you can pass a filename as storage as well.

db.get(key, callback)

Looks up a value. Key can be a buffer or string. If the key does not exist null is passed, otherwise the a Node object looking like this:

{
  key: <key as a buffer>,
  value: <value stored>
}

db.put(key, [value], [callback])

Insert a key and optional value.

License

MIT

FAQs

Package last updated on 12 Jul 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts