it
    Preparing search index...

    Module it-length-prefixed-stream

    This module makes it easy to send and receive length-prefixed byte arrays over streams.

    import { lpStream } from 'it-length-prefixed-stream'

    const stream = lpStream(duplex)

    // read the next length-prefixed chunk
    const bytes = await stream.read()

    // write a length-prefixed chunk
    await stream.write(Uint8Array.from([0, 1, 2, 3, 4]))

    // write several chunks, all individually length-prefixed
    await stream.writeV([
    Uint8Array.from([0, 1, 2, 3, 4]),
    Uint8Array.from([5, 6, 7, 8, 9])
    ])

    Interfaces

    LengthPrefixedStream
    LengthPrefixedStreamOpts

    Functions

    lpStream