{"id":13485077,"url":"https://github.com/lambdalisue/deno-workerio","last_synced_at":"2025-04-30T14:40:21.394Z","repository":{"id":43386822,"uuid":"342811002","full_name":"lambdalisue/deno-workerio","owner":"lambdalisue","description":"🦕 Deno module to translate Worker's system of messages into ReadableStream and WritableStream","archived":false,"fork":false,"pushed_at":"2024-07-30T00:14:26.000Z","size":133,"stargazers_count":13,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-15T21:23:30.461Z","etag":null,"topics":["deno","worker"],"latest_commit_sha":null,"homepage":"https://jsr.io/@lambdalisue/workerio","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/lambdalisue.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":"2021-02-27T08:49:30.000Z","updated_at":"2024-06-01T05:23:57.000Z","dependencies_parsed_at":"2023-12-22T02:54:54.707Z","dependency_job_id":"fd3249a9-07fd-4ad5-bba5-477a0d40407f","html_url":"https://github.com/lambdalisue/deno-workerio","commit_stats":{"total_commits":86,"total_committers":6,"mean_commits":"14.333333333333334","dds":0.4651162790697675,"last_synced_commit":"49f5e0a74a192608dafe4242aba2d92dd3a25abf"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lambdalisue%2Fdeno-workerio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lambdalisue%2Fdeno-workerio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lambdalisue%2Fdeno-workerio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lambdalisue%2Fdeno-workerio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lambdalisue","download_url":"https://codeload.github.com/lambdalisue/deno-workerio/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251722718,"owners_count":21633001,"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":["deno","worker"],"created_at":"2024-07-31T17:01:45.164Z","updated_at":"2025-04-30T14:40:21.366Z","avatar_url":"https://github.com/lambdalisue.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# workerio\n\n[![JSR](https://jsr.io/badges/@lambdalisue/workerio)](https://jsr.io/@lambdalisue/workerio)\n[![Test](https://github.com/lambdalisue/deno-workerio/actions/workflows/test.yml/badge.svg)](https://github.com/lambdalisue/deno-workerio/actions/workflows/test.yml)\n[![codecov](https://codecov.io/gh/lambdalisue/deno-workerio/graph/badge.svg?token=6Q1iOBg2Ka)](https://codecov.io/gh/lambdalisue/deno-workerio)\n\n[Deno][deno] module to translate Worker's system of messages into\n[`ReadableStream\u003cUint8Array\u003e`][readablestream] and\n[`WritableStream\u003cUint8Array\u003e`][writablestream].\n\n[deno]: https://deno.land/\n[ReadableStream]: https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream\n[WritableStream]: https://developer.mozilla.org/en-US/docs/Web/API/WritableStream\n\n## Example\n\n#### Server\n\n```typescript\nimport {\n  readableStreamFromWorker,\n  writableStreamFromWorker,\n} from \"@lambdalisue/workerio\";\n\nconst decoder = new TextDecoder();\nconst encoder = new TextEncoder();\n\nconst worker = new Worker(new URL(\"./worker.ts\", import.meta.url).href, {\n  type: \"module\",\n});\n\nconst reader = readableStreamFromWorker(worker);\nconst writer = writableStreamFromWorker(worker);\nconst w = writer.getWriter();\n\nawait w.write(encoder.encode(\"Hello\"));\nawait w.write(encoder.encode(\"World\"));\nw.releaseLock();\n\nfor await (const data of reader) {\n  const text = decoder.decode(data);\n  console.log(text);\n}\n```\n\n#### Worker\n\n```typescript\n/// \u003creference no-default-lib=\"true\" /\u003e\n/// \u003creference lib=\"deno.worker\" /\u003e\n\nimport {\n  readableStreamFromWorker,\n  writableStreamFromWorker,\n} from \"@lambdalisue/workerio\";\n\nconst decoder = new TextDecoder();\nconst encoder = new TextEncoder();\n\nasync function main(): Promise\u003cvoid\u003e {\n  const reader = readableStreamFromWorker(self);\n  const writer = writableStreamFromWorker(self);\n  const w = writer.getWriter();\n\n  for await (const data of reader) {\n    const text = decoder.decode(data);\n    await w.write(encoder.encode(`!!! ${text} !!!`));\n  }\n  w.releaseLock();\n}\n\nmain().catch((e) =\u003e console.error(e));\n```\n\n## License\n\nThe code follows MIT license written in [LICENSE](./LICENSE). Contributors need\nto agree that any modifications sent in this repository follow the license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flambdalisue%2Fdeno-workerio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flambdalisue%2Fdeno-workerio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flambdalisue%2Fdeno-workerio/lists"}