Wondering what’s next for npm?Check out our public roadmap! »

    length-prefixed-stream

    2.0.0 • Public • Published

    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

    Install

    npm i length-prefixed-stream

    DownloadsWeekly Downloads

    4,608

    Version

    2.0.0

    License

    MIT

    Unpacked Size

    12.3 kB

    Total Files

    9

    Last publish

    Collaborators

    • avatar