{"name":"turbo-stream","version":"3.2.0","keywords":["devalue","turbo","stream","enhanced","json"],"author":{"name":"Jacob Ebey","email":"jacob.ebey@live.com"},"license":"MIT","_id":"turbo-stream@3.2.0","maintainers":[{"name":"jacob-ebey","email":"jacob.ebey@live.com"}],"homepage":"https://github.com/jacob-ebey/turbo-stream#readme","bugs":{"url":"https://github.com/jacob-ebey/turbo-stream/issues"},"dist":{"shasum":"433db9e373b1dbdb272c3817cffb5eb46e4080b4","tarball":"http://registry-npm.ywwl.com/turbo-stream/download/turbo-stream-3.2.0.tgz","fileCount":12,"integrity":"sha512-EK+bZ9UVrVh7JLslVFOV0GEMsociOqVOvEMTAd4ixMyffN5YNIEdLZWXUx5PJqDbTxSIBWw04HS9gCY4frYQDQ==","signatures":[{"sig":"MEYCIQDFsUmhLYAQUz3Ptabmv2nm0ec1glOtqN+9PaGOjRU2wQIhAMA2sTMsJhywwvOLIR/PDpNlwyKT2tK48pJHGCtaZhLS","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":106689,"size":18592,"noattachment":false,"key":"/turbo-stream/-/turbo-stream-3.2.0.tgz"},"main":"dist/turbo-stream.js","types":"dist/turbo-stream.d.ts","exports":{".":{"types":"./dist/turbo-stream.d.ts","import":"./dist/turbo-stream.mjs","default":"./dist/turbo-stream.js","require":"./dist/turbo-stream.js"},"./package.json":"./package.json"},"gitHead":"fb7338b35cc2cd550457b60c22d1792ae7c3d44d","scripts":{"node":"node --no-warnings --loader tsm --enable-source-maps","test":"pnpm node --test-reporter tap --test src/*.spec.ts","bench":"pnpm node ./src/turbo-stream.bench.mts","build":"pnpm build:esm && pnpm build:cjs && cp ./dist/turbo-stream.mjs ./viewer/scripts/turbo-stream.js","build:cjs":"tsc --outDir dist --project tsconfig.lib.json","build:esm":"esbuild --bundle --platform=node --target=node16 --format=esm --outfile=dist/turbo-stream.mjs src/turbo-stream.ts","prepublish":"attw $(npm pack) --ignore-rules false-cjs","test-typecheck":"tsc --noEmit --project tsconfig.spec.json"},"_npmUser":{"name":"jacob-ebey","email":"jacob.ebey@live.com"},"repository":{"url":"git+https://github.com/jacob-ebey/turbo-stream.git","type":"git"},"_npmVersion":"11.6.2","description":"A streaming data transport format that aims to support built-in features such as Promises, Dates, RegExps, Maps, Sets and more.","directories":{},"sideEffects":false,"_nodeVersion":"25.2.1","_hasShrinkwrap":false,"devDependencies":{"tsm":"^2.3.0","expect":"^29.7.0","mitata":"^1.0.33","esbuild":"^0.19.5","pkg-pr-new":"^0.0.39","typescript":"^5.2.2","@types/node":"^20.8.7","@biomejs/biome":"^1.9.4","@arethetypeswrong/cli":"^0.12.2"},"_npmOperationalInternal":{"tmp":"tmp/turbo-stream_3.2.0_1772072977180_0.6075857945103758","host":"s3://npm-registry-packages-npm-production"},"readme":"# Turbo Stream <br> [![turbo-stream's badge](https://deno.bundlejs.com/?q=turbo-stream&badge=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&badge=detailed&treeshake=%5B%7B+decode+%7D%5D)](https://bundlejs.com/?q=turbo-stream&treeshake=%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","publish_time":1772072977323,"_cnpm_publish_time":1772072977323,"dist-tags":{"latest":"3.2.1"}}