{"id":21703588,"url":"https://github.com/codemonument/deno_rx_webstreams","last_synced_at":"2026-05-18T17:39:47.746Z","repository":{"id":62760062,"uuid":"562305034","full_name":"codemonument/deno_rx_webstreams","owner":"codemonument","description":"A deno module to provide rx-like functionalities based on webstreams, esp. transforms like `map()` by @codemonument","archived":false,"fork":false,"pushed_at":"2024-04-17T16:16:01.000Z","size":412,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-25T15:41:25.926Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/codemonument.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2022-11-05T23:13:25.000Z","updated_at":"2022-11-05T23:13:31.000Z","dependencies_parsed_at":"2024-03-24T20:21:57.656Z","dependency_job_id":"ffac4fe1-b463-4270-bb99-799cdf7fbed6","html_url":"https://github.com/codemonument/deno_rx_webstreams","commit_stats":null,"previous_names":[],"tags_count":24,"template":false,"template_full_name":"codemonument/deno_module_template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codemonument%2Fdeno_rx_webstreams","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codemonument%2Fdeno_rx_webstreams/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codemonument%2Fdeno_rx_webstreams/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codemonument%2Fdeno_rx_webstreams/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codemonument","download_url":"https://codeload.github.com/codemonument/deno_rx_webstreams/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244656478,"owners_count":20488638,"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":[],"created_at":"2024-11-25T21:33:41.914Z","updated_at":"2026-05-18T17:39:47.713Z","avatar_url":"https://github.com/codemonument.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rx Webstreams\n\n[![JSR](https://jsr.io/badges/@codemonument/rx-webstreams)](https://jsr.io/@codemonument/rx-webstreams/)\n[![DenoLand/x](https://shield.deno.dev/x/rx_webstreams)](https://deno.land/x/rx_webstreams)\n\n**Note: Limited coverage right now**  \nCompared to rxJS, this lib has not nearly implemented enough at the time.\nBut, all things that are added are inteded to be unit-tested well.\n\nThe good thing: each pice of this lib can be used separately with other webstreams found in any other library.  \nBecause of the webstreams foundation they will likely be compatible.\nIn fact, I use many of these things implemented here myself,\nfor example the timerSource() package for generating example events for testing cli progress bars.  \nSee here for details in the [progress package](https://deno.land/x/progress): https://github.com/deno-library/progress/blob/master/tests/mod.test.ts\n\n## Description\n\nA deno package by [@codemonument](https://github.com/codemonument) with RxJS like functionality, but for webstreams.\nIt provides a lot of predefined sources (aka ReadableStreams), targets (aka WriteableStreams) and especially transforms (aka TransformStreams)!\n\nNote, that the api is inspired by RxJS, but not related in any other way.\nThis package is especially not based on RxJS!\n\n## Parts Overview\n\nFirst: Know the deno std stream utilities! https://deno.land/std@0.220.1/streams/mod.ts\nSee also: This Blogpost: https://medium.com/deno-the-complete-reference/readable-streams-in-deno-e5d707735a77\n\n- Sources: Predefined Readable Streams, like fileSource(), timerSource(), and more\n- Transforms: Predefined Transport Streams, like map(), reduce(), and more\n- Targets: Predefined Writable Streams, like fileTarget(), urlTarget(), and more\n\n### Sources\n\n- timerSource() - implemented ✅\n- fileSource() - implemented ✅ - (with simple Uint8Array Chunks)\n- emitableSource() - implemented ✅ - allows to manually emit chunks into the controller of this readable stream\n- multiplexSource() - implemented ✅ - allows to mix multiple readable streams of same type T into one readable stream.\n  Each chunk will therefore be wrapped into an event object which uniquely identifies the source readable of this chunk in the resulting stream\n- of() - implemented ✅ - creates a readable stream and emits the parameter as the one and only chunk\n- from() - implemented ✅ - creates a readable stream and emits the parameter as chunks, if it is an array\n\n### Transforms\n\n- bytesToString() - implemented ✅ - converts uint8Array chunk to string\n- stringToLines() - implemented ✅ - converts string chunks delimited by newline into one string line per chunk\n- stringToUtf8Bytes() - implemented ✅ - converts string chunks to Uint8Array chunks\n- map() - implemented ✅ - maps from one type of chunk to another\n- filter() - implemented ✅ - removes chunks from a stream based on a predicate function (returns true or false)\n- reduce() - implemented ✅ - allows to collect previous events into a single aggregate.\n  The aggregate will be delivered to further streams at each input event.\n- collect() - in consideration - collects chunks as array with options for: how long should chunks be collected? (specific time, until buffer full, specific count, etc.) and emits the resulting array as event (similar to rxjs buffer)\n\n### Targets\n\n- simpleCallbackTarget() - implemented ✅\n- fileTarget() - planned\n- urlTarget() - in consideration\n\n## Detailed Usage Descriptions\n\nTODO: (Look at the tests in the meantime! They give you a very good idea of how to use those!)\n\n## timerSource()\n\nCreates a stream of events in regular intervalls. Uses `setInterval` unter the hood.\nHas two usage modis:\n\n- \"Count Mode\"\n- Endless Mode\n\nExtended usage:\n\"Waiting for X Seconds in a function with await\"\n\n## Useful Links\n\n- [web.dev - Guide to Webstreams](https://web.dev/streams/)\n- [MDN - General Section on Webstreams](https://developer.mozilla.org/en-US/docs/Web/API/Streams_API)\n- [MDN - Webstreams API Concepts](https://developer.mozilla.org/en-US/docs/Web/API/Streams_API/Concepts)\n- [MDN - Using Readable Streams](https://developer.mozilla.org/en-US/docs/Web/API/Streams_API/Using_readable_streams)\n- [MDN - Using Readable Byte Streams](https://developer.mozilla.org/en-US/docs/Web/API/Streams_API/Using_readable_byte_streams)\n- [MDN - Using Writable Streams](https://developer.mozilla.org/en-US/docs/Web/API/Streams_API/Using_writable_streams)\n- [Interesting Guide to Webstreams on sitepen](https://www.sitepen.com/blog/a-guide-to-faster-web-app-io-and-data-operations-with-streams)\n\n## Open Issues\n\nNothing currently (only that it's an incomplete collection of tools)\n\n## Publishing new version (for maintainers)\n\n1. Run `deno task version x.x.x` to update the version in all files\n2. Update the CHANGELOG.md with the new version and the changes\n3. Commit\n4. Tag the commit with the new version\n5. Push the commit and the tag =\u003e Github Actions publishes the new version to JSR\n\n---\n\n## Decision Archive\n\n### Unified Convention for API Surface of rx_webstreams\n\n- Find unified convetion whether my sources, transforms and targets should be classes or functions!\n\n  - Pro: Classes can have extra methods (for example: starting/stopping a timer source, or emitting chunks manually)\n  - Contra: Can't build an EmittableSource as extends ReadableStream (due to not being able to extract the controller in the constructor)\n    =\u003e Must build EmittableSource as emittableSource.readble to access the underlying readable stream.\n    =\u003e To have unified convention, a class-based system, all classes must then use a `.readable` and `.writable` property\n    =\u003e this is more ugly than accessing the source directly, like: new Source().readable.pipeThrough().pipeTo(new Target().writable)\n\n- Hints:\n  - Deno std/streams uses classes which directly implement ReadableStream, TransformStream or WritableStream.\n    - Delimiter (TransformStream): https://deno.land/std@0.163.0/streams/delimiter.ts?source\n    - Buffer (complete custom, with private readable and writable)\n      https://deno.land/std@0.163.0/streams/buffer.ts?source\n\n=\u003e Decision: Use functions, which return things that can directly be used with .pipeThrough() and .pipeTo().\nThis allow the implementer of these functions to reuse functionality implemented as classes by deno or custom classes from this package, by having a unified interface to the outside world.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodemonument%2Fdeno_rx_webstreams","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodemonument%2Fdeno_rx_webstreams","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodemonument%2Fdeno_rx_webstreams/lists"}