{"id":15066846,"url":"https://github.com/jacob-ebey/turbo-stream","last_synced_at":"2025-05-14T17:02:37.219Z","repository":{"id":203460571,"uuid":"708629921","full_name":"jacob-ebey/turbo-stream","owner":"jacob-ebey","description":"A streaming data transport format that aims to support built-in features such as Promises, Dates, RegExps, Maps, Sets and more.","archived":false,"fork":false,"pushed_at":"2025-02-12T21:30:31.000Z","size":96,"stargazers_count":274,"open_issues_count":3,"forks_count":18,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-06T05:05:30.894Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://turbo-stream.pages.dev/","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/jacob-ebey.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":"2023-10-23T03:54:07.000Z","updated_at":"2025-04-01T14:26:25.000Z","dependencies_parsed_at":null,"dependency_job_id":"1f4ebbc5-3f72-4afb-aebe-2d1c3f0a9ebf","html_url":"https://github.com/jacob-ebey/turbo-stream","commit_stats":null,"previous_names":["jacob-ebey/turbo-stream"],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacob-ebey%2Fturbo-stream","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacob-ebey%2Fturbo-stream/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacob-ebey%2Fturbo-stream/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacob-ebey%2Fturbo-stream/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jacob-ebey","download_url":"https://codeload.github.com/jacob-ebey/turbo-stream/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248688543,"owners_count":21145763,"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-09-25T01:13:01.363Z","updated_at":"2025-04-13T08:54:59.124Z","avatar_url":"https://github.com/jacob-ebey.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Turbo Stream \u003cbr\u003e [![turbo-stream's badge](https://deno.bundlejs.com/?q=turbo-stream\u0026badge=detailed)](https://bundlejs.com/?q=turbo-stream)\n\nStreaming data transport format that supports:\n\n- Streaming promises\n- `undefined`, `null`, `Boolean`, `String`\n- `Bigint`, `Set`, `Map`, `URL`, `RegExp`, `Error`\n- `Number`, including `+Infinity`, `-Infinity` and `NaN`, `-0`\n- Circular references, repeated references\n- `Date`, including invalid dates\n- `Symbol` (`Symbol.from()`)\n- Objects with `toJSON` methods\n- Iterables, AsyncIterable\n- `Buffer`, `ArrayBuffer`, `DataView`, TypedArrays\n- `File`, `Blob`, `FormData`, `ReadableStream`\n\nUses `ReadableStream` as the transport interface for encoding and decoding.\n\nDecode runtime size: [![turbo-stream's badge](https://deno.bundlejs.com/badge?q=turbo-stream\u0026badge=detailed\u0026treeshake=%5B%7B+decode+%7D%5D)](https://bundlejs.com/?q=turbo-stream\u0026treeshake=%5B%7B+decode+%7D%5D)\n\n## Installation\n\n```bash\nnpm install turbo-stream\n```\n\n## Usage\n\n```js\nimport { decode, encode } from \"turbo-stream\";\n\nconst encodedStream = encode(Promise.resolve(42));\nconst decoded = await decode(encodedStream);\nconsole.log(decoded); // 42\n```\n\n## Benchmarks\n\nRun them yourself with `pnpm bench`\n\n```\n• realistic payload\n------------------------------------------- -------------------------------\nJSON                           2.80 µs/iter   2.71 µs █▆                   \n                        (2.59 µs … 5.61 µs)   5.55 µs ██                   \n                    (  2.91 kb …   2.91 kb)   2.91 kb ██▁▂▁▁▁▁▁▂▁▁▁▁▁▁▁▁▁▁▂\nturbo encode                  16.71 µs/iter  16.47 µs  █                   \n                      (16.04 µs … 19.47 µs)  18.38 µs ███                  \n                    (  2.80 kb …   2.81 kb)   2.80 kb ██████▁▁▁▁▁▁▁▁▁▁▁▁▁▁█\nturbo full                    35.30 µs/iter  36.33 µs  █                   \n                     (31.38 µs … 202.79 µs)  52.50 µs  █▃  ▄               \n                    (  2.47 kb … 454.32 kb) 104.44 kb ▂██▃▅█▂▂▂▂▁▁▁▁▁▁▁▁▁▁▁\n\n                             ┌                                            ┐\n                             ┬  ╷\n                        JSON │──┤\n                             ┴  ╵\n                                         ┌┬╷\n                turbo encode             ││┤\n                                         └┴╵\n                                                       ╷┌─┬┐              ╷\n                  turbo full                           ├┤ │├──────────────┤\n                                                       ╵└─┴┘              ╵\n                             └                                            ┘\n                             2.59 µs           27.55 µs            52.50 µs\n\nsummary\n  turbo encode\n   5.97x slower than JSON\n   2.11x faster than turbo full\n```\n\n## Legacy\n\nShout out to Rich Harris and his https://github.com/rich-harris/devalue project. Devalue has heavily influenced this project and portions of the original code was directly lifted from it. I highly recommend checking it out if you need something more cusomizable or without streaming support. This new version has been re-written from the ground up and no longer resembles devalue.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjacob-ebey%2Fturbo-stream","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjacob-ebey%2Fturbo-stream","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjacob-ebey%2Fturbo-stream/lists"}