{"id":19245094,"url":"https://github.com/rxtoolkit/streams","last_synced_at":"2025-09-10T12:33:54.662Z","repository":{"id":214798926,"uuid":"349162137","full_name":"rxtoolkit/streams","owner":"rxtoolkit","description":"🐠 RxJS operators and utilities for working with streams (node.js ReadableStream, pipes, etc.)","archived":false,"fork":false,"pushed_at":"2024-02-16T18:40:34.000Z","size":533,"stargazers_count":1,"open_issues_count":8,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-05T04:23:39.801Z","etag":null,"topics":["fp","functional-programming","nodejs","observables","package","reactive-programming","rxjs","streams"],"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/rxtoolkit.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","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":"2021-03-18T17:30:10.000Z","updated_at":"2024-01-02T15:46:33.000Z","dependencies_parsed_at":"2023-12-30T22:08:30.733Z","dependency_job_id":"47389b88-610c-4f70-b597-1461bf04ea54","html_url":"https://github.com/rxtoolkit/streams","commit_stats":null,"previous_names":["rxtoolkit/streams"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rxtoolkit%2Fstreams","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rxtoolkit%2Fstreams/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rxtoolkit%2Fstreams/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rxtoolkit%2Fstreams/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rxtoolkit","download_url":"https://codeload.github.com/rxtoolkit/streams/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240331361,"owners_count":19784646,"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":["fp","functional-programming","nodejs","observables","package","reactive-programming","rxjs","streams"],"created_at":"2024-11-09T17:26:37.234Z","updated_at":"2025-02-23T15:15:41.736Z","avatar_url":"https://github.com/rxtoolkit.png","language":"JavaScript","readme":"# @rxtk/streams\n\u003e 🐠 RxJS operators and utilities for worth with streams (node.js ReadableStream, pipes, etc.)\n\n## Installation\nThis is a private package. It requires setting up access in your npm config.\n\n```bash\nnpm i @rxtk/streams\n```\n\n```bash\nyarn add @rxtk/streams\n```\n\n## API\n\n### `fromReadableStream`\nCreates an RxJS observable from a node.js ReadableStream.\n```js\nimport {createReadStream} from 'fs';\nimport {fromReadableStream} from '@rxtk/streams';\n\nconst readStream = createReadStream('/path/to/my/file.json');\nconst buffer$ = fromReadableStream(readStream);\nbuffer$.subscribe(console.log);\n// First Buffer content...\n// Second Buffer content...\n// etc.\n```\n\n### `streamFromObservable`\nCreates a node.js ReadableStream from an RxJS observable:\n```js\nimport {streamFromObservable} from '@rxtk/streams';\n\nconst string$ = from([\"hello\", \"wo\", \"rld\", \"!\"]);\nconst readStream = streamFromObservable(string$)\n  .on('data', console.log)\n  .on('error', console.error)\n  .on('end', () =\u003e console.log('DONE'));\n// hello\n// wo\n// rld\n// !\n// DONE\n```\n\n### `toNodePipes`\nThis RxJS operator allows you to use node.js pipes within an RxJS observable.\n```js\nimport {from} from 'rxjs';\nimport csvParser from 'csv-parse';\nimport {toNodePipes} from '@rxtk/streams';\n\nconst csvString$ = from([\n '\"name\",\"systolicBp\",\"dialostilicBp\",\"message\"\\n', \n '\"Blackbeard\",140,91,\"Yarr\"\\n\"Crunch\",120,', \n ',180,\"Arr\"\\n\"Sparrow\",110,70,\"Savvy\"\\n',\n]);\nconst row$ = from(rows);\nconst pipes = [csvParser()];\nconst csvStr$ = string$.pipe(\n  toNodePipes(...pipes)\n);\ncsvStr$.subscribe(console.log);\n// \"message\"\\n\n// \"Hello\"\\n\n// \"My dear sir\\n\"\n// \"Arrr\"\\n\n```\nUnder the hood, this operator does three things:\n1. Transform the input observable into a ReadableStream\n2. Pipe that ReadableStream into the provided pipe(s) (in the same order in which they were passed in)\n3. Pass the stream's output back to an RxJS output Observable\n\n\u003e ⭐️ This operator is meant to be used as syntactic sugar for simple cases.  In some cases, you may need to fine-tune things to your own liking, in which case it might be better to compose your own pipelines from the other helper functions in this module.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frxtoolkit%2Fstreams","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frxtoolkit%2Fstreams","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frxtoolkit%2Fstreams/lists"}