JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 12562
  • Score
    100M100P100Q137838F
  • License MIT

Streaming length prefixed buffers

Package Exports

  • length-prefixed-stream
  • length-prefixed-stream/decode

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 (length-prefixed-stream) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

length-prefixed-stream

Streaming equivalent of length-prefixed-message. This module allow you to send buffers with a varint length prefix to ensure that they will arrive unpartioned

npm install length-prefixed-stream

build status

Usage

var lpstream = require('length-prefixed-stream')

var encode = lpstream.encode() // create an encode stream to send data
var decode = lpstream.decode() // create an decode stream to receive data

encode.write('hello world') // send "hello world"

decode.on('data', function(data) {
  console.log(data.toString()) // will always print "hello world"
})

encode.pipe(decode) // for testing just pipe to our selves

API

transformStream = lpstream.encode()

Creates a new encoder transform stream.

transformStream = lpstream.decode()

Creates a new decoder transform stream.

License

MIT