length-prefix-framed-stream
v2.0.12
Published
Stream framing with length prefixes
Downloads
204
Maintainers
Readme
length-prefix-framed-stream
Stream framing with length prefixes
import { pipeline } from "stream";
import { Encode } from "length-prefix-framed-stream";
const encode = new Encode();
pipeline(encode, aSendStream, e => {});
encode.write("message 1");
encode.write("message 2");
import { pipeline } from "stream";
import { Decode } from "length-prefix-framed-stream";
const decode = new Decode({ objectMode: true, encoding: "utf8" });
pipeline(aReceiveStream, decode, e => {});
for await (const message of decode) {
console.log(message); // whole messages as put in above
}
API
Table of Contents
install
With npm do:
npm install length-prefix-framed-stream
license
BSD-2-Clause