{"id":15641749,"url":"https://github.com/trygve-lie/framed-msg","last_synced_at":"2026-05-02T13:32:03.527Z","repository":{"id":57241358,"uuid":"118726839","full_name":"trygve-lie/framed-msg","owner":"trygve-lie","description":"A framing message protocol for packing multiple opaque binary arguments. Comes with both static and stream based parser API.","archived":false,"fork":false,"pushed_at":"2018-10-01T12:04:17.000Z","size":24,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-21T18:53:42.740Z","etag":null,"topics":["buffer","decoder","encoder","javascript","messaging","nodejs","protocol","socket","stream"],"latest_commit_sha":null,"homepage":"","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/trygve-lie.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}},"created_at":"2018-01-24T07:06:53.000Z","updated_at":"2023-11-27T01:03:29.000Z","dependencies_parsed_at":"2022-09-08T00:40:52.334Z","dependency_job_id":null,"html_url":"https://github.com/trygve-lie/framed-msg","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/trygve-lie/framed-msg","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trygve-lie%2Fframed-msg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trygve-lie%2Fframed-msg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trygve-lie%2Fframed-msg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trygve-lie%2Fframed-msg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/trygve-lie","download_url":"https://codeload.github.com/trygve-lie/framed-msg/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trygve-lie%2Fframed-msg/sbom","scorecard":{"id":900241,"data":{"date":"2025-08-11","repo":{"name":"github.com/trygve-lie/framed-msg","commit":"66f58038cd7d2b931a8d04043e3f51c399719445"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/24 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 8 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-24T15:18:42.181Z","repository_id":57241358,"created_at":"2025-08-24T15:18:42.181Z","updated_at":"2025-08-24T15:18:42.181Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32536576,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-02T12:25:33.646Z","status":"ssl_error","status_checked_at":"2026-05-02T12:24:51.733Z","response_time":132,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["buffer","decoder","encoder","javascript","messaging","nodejs","protocol","socket","stream"],"created_at":"2024-10-03T11:45:00.007Z","updated_at":"2026-05-02T13:32:03.440Z","avatar_url":"https://github.com/trygve-lie.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# framed-msg\n\n[![Dependencies](https://img.shields.io/david/trygve-lie/framed-msg.svg?style=flat-square)](https://david-dm.org/trygve-lie/framed-msg)[![Build Status](http://img.shields.io/travis/trygve-lie/framed-msg/master.svg?style=flat-square)](https://travis-ci.org/trygve-lie/framed-msg)\n\nA framing message protocol for packing multiple opaque binary arguments. Comes\nwith both static and stream based parser API.\n\n## Installation\n\n```bash\n$ npm install framed-msg\n```\n\n## Examples\n\nEncode and decode a message:\n\n```js\nconst fmsg = require('framed-msg');\nconst bin = fmsg.encode([Buffer.from('Hello'), Buffer.from('World')]);\nconst msg = fmsg.decode(bin);\n\nconsole.log(msg[0].toString(), msg[1].toString()); // Prints; Hello World\n```\n\nStream decoding a message:\n\n```js\nconst fmsg = require('framed-msg');\n\nconst msg = new fmsg.DecodeStream();\nmsg.pipe(process.stdout)\n\nconst bin = fmsg.encode([Buffer.from('Hello'), Buffer.from('World')]);\nmsg.write(bin);\n```\n\n## API\n\nThis module have the following API:\n\n### .encode(bufs)\n\nEncodes an Array of Buffers into a framed message.\n\n```js\nconst fmsg = require('framed-msg');\nconst bin = fmsg.encode([Buffer.from('Hello'), Buffer.from('World')]);\n```\n\n### .decode(message)\n\nDecodes a framed message into an Array of Buffers.\n\n```js\nconst fmsg = require('framed-msg');\nconst msg = fmsg.decode(msgFromEncoder);\n```\n\n### .streamDecode()\n\nA transform stream for stream decoding framed messages.\n\n```js\nconst stream = require('stream');\nconst fmsg = require('framed-msg');\nconst net = require('net');\n\nnet.createServer((socket) =\u003e {\n    const decoder = new fmsg.DecodeStream();\n    socket.pipe(decoder).pipe(new stream.Writable({\n        objectMode: true,\n        write: (chunk, enc, next) =\u003e {\n            console.log(chunk[0].toString());  // Hello\n            console.log(chunk[1].toString());  // World\n            next();\n        }\n    }));\n}).listen(3000);\n\nconst client = net.connect(3000);\nconst msg = fmsg.encode([Buffer.from('Hello'), Buffer.from('Worlds')]);\nclient.write(msg);\n```\n\n### .streamEncode()\n\nA transform stream for stream encoding framed messages.\n\n```js\nconst stream = require('stream');\nconst fmsg = require('framed-msg');\nconst net = require('net');\n\nnet.createServer((socket) =\u003e {\n    const decoder = new fmsg.DecodeStream();\n    socket.pipe(decoder).pipe(new stream.Writable({\n        objectMode: true,\n        write: (chunk, enc, next) =\u003e {\n            console.log(chunk[0].toString());  // Hello\n            console.log(chunk[1].toString());  // World\n            next();\n        }\n    }));\n}).listen(3000);\n\nconst client = net.connect(3000);\n\nconst encoder = new fmsg.EncodeStream();\nconst src = new stream.Readable({\n    objectMode: true,\n    read() {\n        this.push([Buffer.from('Hello'), Buffer.from('Worlds')]);\n        this.push(null);\n    }\n});\n\nsrc.pipe(encoder).pipe(client)\n```\n\n\n## Protocol\n\nThe protocol goes as follow. The first byte of the message contains an\nargument count of the number of arguments to expect in the message.\n\nIts then followed by a pair of size frames and arguments. The size\nframe is a 32-bit unsigned integer providing the size of the following\nargument. The argument can be any opaque binary so it can hold any\nString, stringified JSON, image etc...\n\nThe massage can hold up to 128 arguments.\n\n```\n+--------+----------+--------+----------+--------+\n| \u003cargc\u003e | \u003clength\u003e | \u003cdata\u003e | \u003clength\u003e | \u003cdata\u003e | etc..\n+--------+----------+--------+----------+--------+\n```\n\n\n## Benchmarks\n\nOn node.js version 9.4.0:\n\n```sh\n\u003e node benchmark/main.js\n\n.encode() x 2,096,246 ops/sec ±0.69% (91 runs sampled)\n.decode() x 5,474,602 ops/sec ±1.20% (93 runs sampled)\n.decodeStream() x 1,044,913 ops/sec ±31.77% (67 runs sampled)\n```\n\n\n## node.js compabillity\n\nThis module is written in ES6 and uses some functions only found in node.js 8.2\nand newer. This module will not function with older than 8.2 versions of node.js.\n\n\n## License\n\nThe MIT License (MIT)\n\nCopyright (c) 2018 - Trygve Lie - post@trygve-lie.com\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrygve-lie%2Fframed-msg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrygve-lie%2Fframed-msg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrygve-lie%2Fframed-msg/lists"}