turbo-stream
A streaming data transport format that aims to support built-in features such as Promises, Dates, RegExps, Maps, Sets and more.
Last updated 4 months ago by jacob-ebey .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ npm install turbo-stream 
SYNC missed versions from official npm registry.

Turbo Stream
turbo-stream's badge

A streaming data transport format that aims to support built-in features such as Promises, Dates, RegExps, Maps, Sets and more.

Decode runtime size: turbo-stream's badge

Shout Out!

Shout out to Rich Harris and his https://github.com/rich-harris/devalue project. Devalue has heavily influenced this project and portions of the code have been directly lifted from it. I highly recommend checking it out if you need something more cusomizable or without streaming support.

Installation

npm install turbo-stream

Usage

import { decode, encode } from "turbo-stream";

const encodedStream = encode(Promise.resolve(42));
const decoded = await decode(encodedStream);
console.log(decoded.value); // a Promise
console.log(await decoded.value); // 42
await decoded.done; // wait for the stream to finish

Stackblitz: https://stackblitz.com/edit/stackblitz-starters-2wm7dh?file=index.js React SSR Example: https://github.com/jacob-ebey/turbo-stream-react-example

Current Tags

  • 2.4.1                                ...           latest (3 months ago)

27 Versions

  • 2.4.1                                ...           3 months ago
  • 2.4.0                                ...           4 months ago
  • 2.3.0                                ...           4 months ago
  • 2.2.3                                ...           4 months ago
  • 2.2.2                                ...           4 months ago
  • 2.2.1                                ...           4 months ago
  • 2.2.0                                ...           7 months ago
  • 2.1.0                                ...           7 months ago
  • 2.0.1                                ...           8 months ago
  • 2.0.0                                ...           10 months ago
  • 1.2.1                                ...           10 months ago
  • 1.2.0                                ...           a year ago
  • 1.1.1                                ...           a year ago
  • 1.1.0                                ...           a year ago
  • 1.0.4                                ...           a year ago
  • 1.0.3                                ...           a year ago
  • 1.0.2                                ...           a year ago
  • 1.0.1                                ...           a year ago
  • 1.0.0                                ...           a year ago
  • 0.0.8                                ...           a year ago
  • 0.0.7                                ...           a year ago
  • 0.0.6                                ...           a year ago
  • 0.0.5                                ...           a year ago
  • 0.0.4                                ...           a year ago
  • 0.0.3                                ...           a year ago
  • 0.0.2                                ...           a year ago
  • 0.0.1                                ...           a year ago
Maintainers (1)
Downloads
Total 1
Today 1
This Week 1
This Month 1
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (6)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE