dat-stream-replicator
Streaming replicator for dat-graph
npm install dat-stream-replicator
Usage
var replicator =var dat = datGraphInstancevar otherDat = anotherDatGraphInstancevar stream =var otherStream =stream
API
var stream = replicator(datGraph, [options])
Create a new replication stream for a dat-graph instance. Options include:
// gzip the nodes being sent. both sides have to say `true` for gzip to be enabled// defaults to truegzip: true// only pull/push or do a two way sync. defaults to syncmode: 'sync'
var stream = replicator.pull(datGraph, [options])
Shorthand for {mode: 'pull'}
var stream = replicator.push(datGraph, [options])
Shorthand for {mode: 'push'}
Progress monitoring
The stream will emit progress events when pushing / pulling. The events look like this
streamstream
You can always access the latest pushed/pulled event as stream.pushed
and stream.pulled
.
License
MIT