Package Exports
- pull-length-prefixed
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (pull-length-prefixed) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
pull-length-prefixed
Streaming length prefixed buffers with pull-streams
Install
$ npm install --save pull-length-prefixed
Usage
var pull = require('pull-stream')
var lp = require('pull-length-prefixed')
// encode
pull(
pull.values([Buffer.from('hello world')]),
lp.encode(),
pull.collect(function (err, encode) {
if (err) throw err
console.log(encoded)
// => [Buffer <0b 68 65 6c 6c 6f 20 77 6f 72 6c 64>]
})
)
// decode
pull(
pull.values(encoded), // e.g. from above
lp.decode(),
pull.collect(function (err, decoded) {
if (err) throw err
console.log(decoded)
// => [Buffer <68 65 6c 6c 6f 20 77 6f 72 6c 64>]
})
)