{"name":"turbo-stream","version":"3.0.0","keywords":["devalue","turbo","stream","enhanced","json"],"author":{"name":"Jacob Ebey","email":"jacob.ebey@live.com"},"license":"MIT","_id":"turbo-stream@3.0.0","homepage":"https://github.com/jacob-ebey/turbo-stream#readme","bugs":{"url":"https://github.com/jacob-ebey/turbo-stream/issues"},"dist":{"shasum":"9c95878d860a66242b56f4d2b24f8759d8008614","tarball":"http://registry-npm.ywwl.com/turbo-stream/download/turbo-stream-3.0.0.tgz","fileCount":12,"integrity":"sha512-cD7s7mh0XtUa+sE5Ej1ShRrWGKiAZ1X/l4clV7Dyg4A+u9jf2pbTTKDApeW0B7Za5o/tNCGzNTLFHBAVxeQC6g==","signatures":[{"sig":"MEUCIFSKrTDQazdW/emds0ImepnHj1hK8jExfptcdJ+Q6uJWAiEA6Xqs8b7xsrXJPzWSxHCsgmygq1+uWHjchLQH6OMvffA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":102241,"size":17606,"noattachment":false,"key":"/turbo-stream/-/turbo-stream-3.0.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":"23bc47b69736ea4c2ca2c303605e9a649f1e1dcd","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":"10.8.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":"18.20.6","_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.0.0_1738690608909_0.7162259883608462","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\nA streaming data transport format that aims to support built-in features such as Promises, Dates, RegExps, Maps, Sets and more.\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":1738690609118,"maintainers":[{"name":"jacob-ebey","email":"jacob.ebey@live.com"}],"_cnpm_publish_time":1738690609118,"dist-tags":{"latest":"3.2.1"}}