read-bytes-stream
Read
n
bytes of a stream, then swap to another stream
Usage
var readBytes = var xsalsaStream = var nonce = Buffervar key = Buffer var streamCipher =
API
var stream = readBytes(n, onchunk)
Will read n
bytes, unless the source stream ends prematurely.
onchunck(bytes, swap)
will be called with as many bytes as was read,
but at most n
, and a callback to either return an Error
or swap to another
stream. You can optionally re-write the received bytes to the new stream which
effectively turns this module into peek-stream
Install
npm install read-bytes-stream