dat-replication-protocol
Streaming implementation of the dat replication protocol
npm install dat-replication-protocol
Usage
var protocol =var decode = protocolvar encode = protocoldecodedecodedecode// write changes dataencodevar blob = encode // 12 is the length of the blobblobblobblobencode // end the encode stream// set up the pipelinee
Wire format
Basically all changes and blobs are sent as multibuffers (varint prefixed).
--------------------------------------------------
| varint length | single byte id | payload |
--------------------------------------------------
Since blobs can be large they are treated as streams.
License
MIT