1.0.2 • Published 5 months ago
beelite v1.0.2
beelite
Hyperbee and Hypercore in one
npm i beelite
Usage
Use a directory:
const Beelite = require('beelite')
const db = new Beelite('./storage')
await db.put('/key', 'value')
const entry = await db.get('/key')
// Use it as Hyperbee..
Use RAM easily:
const db = new Beelite(':ram')
// ...
Use a Hypercore directly:
const Hypercore = require('hypercore')
const core = new Hypercore(...)
// Or corestore.get({ name: 'a' })
const db = new Beelite(core)
// ...
db = new Beelite(storage[, key, options])
Create a new Beelite instance.
It's just a Hyperbee with additions in the constructor.
The storage can be :ram
for random-access-memory
, a dir path, or a core.
Options:
{
// Defaults for Beelite specifically
alwaysDuplicate: false,
keyEncoding: 'utf8',
valueEncoding: c.any // compact-encoding
// The rest of the Hyperbee options are available also.
}
License
MIT