https://github.com/arlac77/length-prefix-framed-stream
Socket framing with length prefixes
https://github.com/arlac77/length-prefix-framed-stream
Last synced: about 1 year ago
JSON representation
Socket framing with length prefixes
- Host: GitHub
- URL: https://github.com/arlac77/length-prefix-framed-stream
- Owner: arlac77
- License: 0bsd
- Created: 2020-07-30T09:42:17.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2025-03-17T13:02:49.000Z (about 1 year ago)
- Last Synced: 2025-03-29T01:03:07.064Z (about 1 year ago)
- Language: JavaScript
- Size: 1.45 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://www.npmjs.com/package/length-prefix-framed-stream)
[](https://spdx.org/licenses/0BSD.html)
[](https://bundlejs.com/?q=length-prefix-framed-stream)
[](https://npmjs.org/package/length-prefix-framed-stream)
[](https://github.com/arlac77/length-prefix-framed-stream/issues)
[](https://actions-badge.atrox.dev/arlac77/length-prefix-framed-stream/goto)
[](https://github.com/prettier/prettier)
[](http://commitizen.github.io/cz-cli/)
[](https://snyk.io/test/github/arlac77/length-prefix-framed-stream)
[](https://coveralls.io/github/arlac77/length-prefix-framed-stream)
# length-prefix-framed-stream
Stream framing with length prefixes
```js
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");
```
```js
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](http://npmjs.org) do:
```shell
npm install length-prefix-framed-stream
```
# license
BSD-2-Clause