{"id":19621403,"url":"https://github.com/commenthol/streamss","last_synced_at":"2026-06-15T05:34:48.017Z","repository":{"id":24601274,"uuid":"28009817","full_name":"commenthol/streamss","owner":"commenthol","description":"A stream2 collection","archived":false,"fork":false,"pushed_at":"2021-10-10T05:37:53.000Z","size":62,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-26T18:53:37.714Z","etag":null,"topics":["event-streams","stream2","stream2-collection"],"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/commenthol.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":"2014-12-14T22:07:06.000Z","updated_at":"2021-10-10T05:37:56.000Z","dependencies_parsed_at":"2022-07-15T18:30:29.539Z","dependency_job_id":null,"html_url":"https://github.com/commenthol/streamss","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/commenthol/streamss","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commenthol%2Fstreamss","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commenthol%2Fstreamss/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commenthol%2Fstreamss/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commenthol%2Fstreamss/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/commenthol","download_url":"https://codeload.github.com/commenthol/streamss/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commenthol%2Fstreamss/sbom","scorecard":{"id":300847,"data":{"date":"2025-08-11","repo":{"name":"github.com/commenthol/streamss","commit":"42a6bb9649f60c28c7bbf8cd53f1b0dd2b0c7337"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/21 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":"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":"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":"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":"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":"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":"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":"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":"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":"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":"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 10 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-17T20:35:17.699Z","repository_id":24601274,"created_at":"2025-08-17T20:35:17.699Z","updated_at":"2025-08-17T20:35:17.699Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34349925,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-15T02:00:07.085Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["event-streams","stream2","stream2-collection"],"created_at":"2024-11-11T11:22:49.932Z","updated_at":"2026-06-15T05:34:47.996Z","avatar_url":"https://github.com/commenthol.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# streamss\n\n\u003e A stream2 collection.\n\n[![NPM version](https://badge.fury.io/js/streamss.svg)](https://www.npmjs.com/package/streamss/)\n[![Build Status](https://secure.travis-ci.org/commenthol/streamss.svg?branch=master)](https://travis-ci.org/commenthol/streamss)\n\nA stream2 collection for common stream use-cases.\n\n* Split, SplitLine : (Transform) Splits up a stream into pieces\n* JsonArray : (Transform) Json parse a line into an object stream and/or stringify back into a single line.\n* ReadArray : (Readable) Read from an Array and push it as stream.\n* ReadBuffer : (Readable) Read from an Buffer/ String and push it as stream\n* WriteArray : (Writable) Collects stream chunks into Array\n\nWorks with node v0.8.x and greater.\nFor node v0.8.x the user-land copy [readable-stream][] is used.\nFor all other node versions greater v0.8.x the built-in `stream` module is used.\n\n## Table of Contents\n\n\u003c!-- !toc (minlevel=2 omit=\"Table of Contents\") --\u003e\n\n* [Interface](#interface)\n  * [Split([options])](#splitoptions)\n  * [SplitLine([options])](#splitlineoptions)\n  * [JsonArray([options])](#jsonarrayoptions)\n  * [JsonArray.parse([options])](#jsonarrayparseoptions)\n  * [JsonArray.stringify([options])](#jsonarraystringifyoptions)\n  * [ReadArray([options], array)](#readarrayoptions-array)\n  * [ReadArray.obj([options], array)](#readarrayobjoptions-array)\n  * [ReadBuffer([options], buffer)](#readbufferoptions-buffer)\n  * [WriteArray([options], callback)](#writearrayoptions-callback)\n  * [WriteArray.obj([options], callback)](#writearrayobjoptions-callback)\n  * [Through](#through)\n* [Contribution and License Agreement](#contribution-and-license-agreement)\n* [License](#license)\n\n\u003c!-- toc! --\u003e\n\n## Interface\n\n### Split([options])\n\n\u003e Split a stream using a regexp or string based matcher\n\n**Parameters:**\n\n- `{Object} [options]` - Stream Options `{encoding, highWaterMark, decodeStrings, ...}`\n- `{RegExp | String} options.matcher` - RegExp or String use for splitting up the stream. Default=`/(\\r?\\n)/`\n\n**Return:**\n\n`{Transform}` A transform stream\n\n#### Example\n\n```javascript\nconst { Split, Through } = require('streamss')\n\nrequire('fs').createReadStream(__dirname + '/../test/test.txt')\n  .pipe(Split({ matcher: ' are ', encoding: 'utf8' }))\n  .pipe(Through(\n    { decodeStrings: false },\n    function(string) {\n      this.push('\u003e\u003e\u003e' + string + '\u003c\u003c\u003c\\n')\n    }\n  ))\n  .pipe(process.stdout)\n```\n\nRun in terminal:\n\n```\nnode examples/split.js\n```\n\n### SplitLine([options])\n\n\u003e Split a stream by a single char\n\nWorks on buffers - should therefore be faster than `Split`.\n\n**Parameters:**\n\n- `{Object} [options]` - Stream Options `{encoding, highWaterMark, ...}`\n- `{Boolean} options.chomp` - Do not emit the matching char. Default=false\n- `{String} options.matcher` - String use for splitting up the stream. Default=0x0a\n\n**Return:**\n\n`{Transform}` A transform stream\n\n#### Example\n\n```javascript\nconst { Split, Through } = require('streamss')\n\nrequire('fs').createReadStream(__dirname + '/../test/test.txt')\n  .pipe(SplitLine({ matcher: 'i', chomp: true, encoding: 'utf8' }))\n  .pipe(Through(\n    { decodeStrings: false },\n    function(string) {\n      this.push('\u003e\u003e\u003e' + string + '\u003c\u003c\u003c\\n')\n    }\n  ))\n  .pipe(process.stdout)\n```\n\nRun in terminal:\n\n```\nnode examples/splitline.js\n```\n\n\n### JsonArray([options])\n\n\u003e JSON.parse a line and push as object down the pipe.\n\nIf `stringify: true` is set, a received object is stringified with JSON.stringify\nThe output of the stream will be a valid JSON array.\n\nNOTE: Requires that the stream is split beforehand using `Split` or `SplitLine`.\n\n**Parameters:**\n\n- `{Object} [options]` - Options\n- `{Boolean} options.stringify` - Transforms an object into a string using JSON.stringify. Default=false.\n- `{Boolean} options.error` - Emit parsing errors as `Error` objects. Default=false.\n- `{Boolean} options.validJson` - Write out a valid json file, which can be parsed as a whole. Default=true.\n\n**Return:**\n\n`{Transform}` A transform stream\n\n### JsonArray.parse([options])\n\n\u003e Shortcut for parse\n\n**Parameters:**\n\n- `{Object} [options]` - Options\n- `{Boolean} options.error` - Emit parsing errors as `Error` objects. Default=false.\n  **Return:**\n\n`{Transform}` A transform stream\n\n### JsonArray.stringify([options])\n\n\u003e Shortcut for stringify\n\n**Parameters:**\n\n- `{Object} [options]` - Options\n- `{Boolean} options.validJson` - Write out a valid json file, which can be parsed as a whole. Default=true.\n\n**Return:**\n\n`{Transform}` A transform stream\n\n#### Example\n\n```javascript\nconst { JsonArray, SplitLine } = require('streamss')\n\nrequire('fs').createReadStream(__dirname + '/../test/test.json')\n  .pipe(SplitLine())\n  .pipe(JsonArray.parse())\n  .pipe(JsonArray.stringify())\n  .pipe(process.stdout)\n```\n\nRun in terminal:\n\n```\nnode examples/jsonarray.js\n```\n\n### ReadArray([options], array)\n\n\u003e Read from an Array and push into stream.\n\nTakes care on pausing to push to the stream if pipe is saturated.\n\n**Parameters:**\n\n- `{Object} [options]` - Stream Options `{encoding, highWaterMark, decodeStrings, ...}`\n- `{Array} array` - array to push down as stream (If array is an array of objects set `objectMode:true` or use `ReadArray.obj`)\n\n**Return:**\n\n`{Readable}` A readable stream\n\n### ReadArray.obj([options], array)\n\n\u003e Shortcut for objectMode\n\n**Parameters:**\n\n- `{Object} [options]` - Stream Options `{encoding, highWaterMark, decodeStrings, ...}`\n- `{Array} array` - array to push down as stream\n\n**Return:**\n\n`{Readable}` A readable stream\n\n### ReadBuffer([options], buffer)\n\n\u003e Read from an Buffer/ String and push into stream.\n\nTakes care on pausing to push to the stream if pipe is saturated.\nPushes only size bytes if `highWaterMark` is set.\n\n**Parameters:**\n\n- `{Object} [options]` - Stream Options `{encoding, highWaterMark, ...}`\n- `{Buffer | String} buffer` - buffer to push down as stream\n\n**Return:**\n\n`{Readable}` A readable stream\n\n#### Example\n\nPushes a string per 7 bytes as stream into an array.\n\n```javascript\nconst { ReadArray, WriteArray } = require('streamss')\n\nconst str = \"line 1\\nline 2\\nline 3\\nline 4\";\n\nReadBuffer(\n  {highWaterMark: 7, encoding: 'utf8'},\n  str\n).pipe(WriteArray(\n  { decodeStrings: false },\n  function(err, arr){\n    console.log(arr)\n    //\u003e [ 'line 1\\n', 'line 2\\n', 'line 3\\n', 'line 4' ]\n  })\n)\n```\n\n### WriteArray([options], callback)\n\n\u003e Write stream into an Array\n\n**Parameters:**\n\n- `{Object} [options]` - Stream Options `{encoding, highWaterMark, decodeStrings, objectMode, ...}`\n- `{Function} callback` - callback function called on `finish` or `error` event. Form is `function(err, array)`.\n\n**Return:**\n\n`{Writable}` A writable stream\n\n### WriteArray.obj([options], callback)\n\n\u003e Shortcut for ObjectMode\n\n**Parameters:**\n\n- `{Object} [options]` - Stream Options `{encoding, highWaterMark, decodeStrings, ...}`\n- `{Function} callback` - callback function called on `finish` or `error` event. Form is `function(err, array)`.\n\n**Return:**\n\n`{Writable}` A writable stream\n\n#### Example\n\n```javascript\nconst { ReadArray, WriteArray, Through } = require('streamss')\n\nconst array = [ '1', '2', '3', '4', '5', '6', '7', '8', '9', '10' ]\nlet cnt = 0\n\nReadArray(\n  { encoding: 'utf8'},\n  array\n)\n.pipe(Through(\n  { encoding: 'utf8'},\n  function(str) {\n    if (cnt++ % 2) {\n      this.push(str)\n    }\n  }\n))\n.pipe(WriteArray(\n  { decodeStrings: false },\n  function(err, arr){\n    console.log(arr)\n    //\u003e [ '2', '4', '6', '8', '10' ]\n  })\n)\n```\n\nRun in terminal:\n\n```\nnode examples/readwritearray.js\n```\n\n### Through\n\nSee [streamss-through][].\n\n\n## Contribution and License Agreement\n\nIf you contribute code to this project, you are implicitly allowing your code\nto be distributed under the MIT license. You are also implicitly verifying that\nall code is your original work.\n\n* `npm test`      - Run tests\n* `npm run lint`  - Linting the source\n* `npm run cover` - Run istanbul code coverage\n* `npm run doc`   - Generate documentation from source\n\n## License\n\nCopyright (c) 2014, Commenthol. (MIT License)\n\nSee [LICENSE][] for more info.\n\n[LICENSE]: ./LICENSE\n[streamss-through]: https://github.com/commenthol/streamss-through\n[readable-stream]: https://github.com/isaacs/readable-stream\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommenthol%2Fstreamss","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcommenthol%2Fstreamss","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommenthol%2Fstreamss/lists"}