level-dat
LevelDB storage backend for Dat
npm install level-dat
Usage
var ldat =db = // where db is levelup instancedb
API
In general the API is the same as the levelup api
db.put(key, value, [opts], [cb])
Insert a key and value. Use opts.version = number
to specify the version.
db.get(key, [opts], cb)
Get a key and value and version.
db.del(key, [cb])
Delete a key.
var subdb = db.subset(name)
Create a subset database that will be versioned and replicated as well
db.stat(cb)
Returns a digest of all rows in the database.
db.createReadStream([opts])
Create a read stream to the database. Data includes the version.
db.createValueStream([opts])
Only get the values.
db.createKeyStream([opts])
Only get the keys.
db.createVersionStream(key, [opts])
Get all stored versions of a key.
db.createWriteStream([opts])
Stream data into the database. Data can include versions.
db.createChangesReadStream([opts])
Get a change feed stream from the database. Set options.since = change
to only get a partial stream and options.data
to get the data as well.
db.createChangesWriteStream([opts])
Pipe a change feed into the change write stream to replicate a database.
License
MIT