{"_id":"turbo-stream@3.2.1","dist":{"shasum":"4fb1ac3b0575cde54c9b1f49290adcbff1ca96d5","tarball":"http://registry-npm.ywwl.com/turbo-stream/download/turbo-stream-3.2.1.tgz","fileCount":18,"integrity":"sha512-BaX0eWz3IrypOVDFqPv3VGD6uZZW8y3oFAOJqZQ+oopmOyQ8/xNm7IMwAJFvxax2DBa8zSk+/AeqA6D6b1PXGg==","signatures":[{"sig":"MEQCIDyAqXCGgxSW5DkMLZUJubhTFfUYwMptwBnlLlICdcjrAiASVw7H9zSOtAyaLtRtDG/AbaOLRJx1O8wQMVauCE9blQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCSmFQ7EJj3hR/js/uWv2i1q9IeLVOhm8AodPb6PV495gIhAKd3BWme+nP3KCevbTSVVVFMQ5indfKiJhl06rVvMGau"}],"unpackedSize":129093,"size":22491,"noattachment":false,"key":"/turbo-stream/-/turbo-stream-3.2.1.tgz"},"main":"dist/turbo-stream.js","name":"turbo-stream","types":"dist/turbo-stream.d.ts","author":"Jacob Ebey <jacob.ebey@live.com>","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"},"license":"MIT","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"},"version":"3.2.1","_npmUser":{"name":"jacob-ebey","email":"jacob.ebey@live.com"},"keywords":["devalue","turbo","stream","enhanced","json"],"repository":{"url":"https://github.com/jacob-ebey/turbo-stream.git","type":"git"},"description":"A streaming data transport format that aims to support built-in features such as Promises, Dates, RegExps, Maps, Sets and more.","directories":{},"maintainers":[{"name":"jacob-ebey","email":"jacob.ebey@live.com"}],"sideEffects":false,"_nodeVersion":"24.19.0","_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":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/turbo-stream_3.2.1_1787102793945_0.29564241671267966"},"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":1787102794099,"_cnpm_publish_time":1787102794099,"dist-tags":{"latest":"3.2.1"}}