length-prefix-framed-stream

2.0.12 • Public • Published

npm License Open Bundle downloads GitHub Issues Build Status Styled with prettier Commitizen friendly Known Vulnerabilities Coverage Status

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

Package Sidebar

Install

npm i length-prefix-framed-stream

Weekly Downloads

60

Version

2.0.12

License

BSD-2-Clause

Unpacked Size

6.7 kB

Total Files

4

Last publish

Collaborators

  • arlac77