{"id":22202150,"url":"https://github.com/rumkin/boundary-stream","last_synced_at":"2025-03-25T01:42:27.446Z","repository":{"id":143864657,"uuid":"61729642","full_name":"rumkin/boundary-stream","owner":"rumkin","description":"Length prefixed stream encoder and decoder for network transport","archived":false,"fork":false,"pushed_at":"2018-02-28T13:48:03.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-03T13:19:58.690Z","etag":null,"topics":["boundary-stream","javascript","streams","transport-protocols"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rumkin.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-06-22T15:20:45.000Z","updated_at":"2018-03-15T16:13:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"1692be1e-f4f4-472d-a9c1-df025054bf74","html_url":"https://github.com/rumkin/boundary-stream","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rumkin%2Fboundary-stream","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rumkin%2Fboundary-stream/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rumkin%2Fboundary-stream/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rumkin%2Fboundary-stream/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rumkin","download_url":"https://codeload.github.com/rumkin/boundary-stream/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245383118,"owners_count":20606265,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["boundary-stream","javascript","streams","transport-protocols"],"created_at":"2024-12-02T16:12:34.611Z","updated_at":"2025-03-25T01:42:27.440Z","avatar_url":"https://github.com/rumkin.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Boundary Stream\n\n[![npm](https://img.shields.io/npm/v/boundary-stream.svg?style=flat-square)](https://npmjs.com/packages/boundary-stream)\n\nBoundary stream converts passed data into length prefixed buffers.\nIt helps to send data via tcp connection. Length prefixed protocols are more speed\nefficient then delimiter based (like HTTP).\n\nBoundary stream can handle any size of message. The only limit is RAM size.\nIt supports String or Buffer transfer and fits for JSON, MsgPack, CBOR and BORN\nencoders.\n\n## Install\n\nInstall via npm:\n\n```shell\nnpm i boundary-stream\n```\n\n## Usage\n\nExample of raw Buffer message transfer.\n\n### Client\n\n```javascript\nconst net = require('net');\nconst boundary = require('boundary-stream');\n\nconst conn = net.connect(9090);\n\nconn.on('connect', () =\u003e {\n    const writer = boundary.writer();\n\n    writer.pipe(conn);\n\n    writer.write(Buffer.alloc(10 * 1024 * 1024)); // Send 10 MiB buffer\n    writer.end();\n});\n\n// ...\n```\n\n### Server\n\n```javascript\nconst net = require('net');\nconst boundary = require('boundary-stream');\n\nconst server = net.createServer(function(conn){\n    let reader = boundary.reader();\n\n    reader.on('data', (message) =\u003e {\n        console.log(message.length); // -\u003e 10485760\n    });\n\n    conn.pipe(reader);\n});\n\n// ...\n```\n\n## API\n\n### writer() -\u003e Writer{}\n\nCreate Writer instance.\n\n### reader() -\u003e Reader{}\n\nCreate Reader instance.\n\n### Writer()\n\nWriter constructor\n\n### Writer().write(String|Buffer)\n\nWrite message to stream.\n\n### Reader()\n\nReader constructor\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frumkin%2Fboundary-stream","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frumkin%2Fboundary-stream","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frumkin%2Fboundary-stream/lists"}