hyperlog-data
save/load a hyperlog to/from a stream of bytes
example
save
save a hyperlog to a stream of bytes for external storage:
var hyperlog =var memdb =var hdata =var fs =var log =logvar data =A: links: data: 'hello'B: links: 'A' data: 'world'C: links: 'A' data: 'zzz'D: links: 'B''C' data: 'zing'var keys = Objectvar nodes = {}; {if keyslength === 0 returnvar key = keysvar links = datakeylinkslog}null
load
populate a hyperlog with previously exported data from a stream of bytes:
var hyperlog =var memdb =var hdata =var fs =var log =fslog
api
var hdata =
var stream = hdata.save()
Return a transform object stream
that reads rows from a hyperlog's
createReadStream()
and outputs bytes.
var stream = hdata.load(log, cb)
Return a readable stream
that reads bytes from an exported hyperlog and
populates log
with the data. When the log
is finished being written to,
cb(err)
fires.
install
npm install hyperlog-data
license
BSD