2.0.1 • Published 9 days ago

turbo-stream v2.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
9 days ago

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

2.0.1

9 days ago

2.0.0

2 months ago

1.2.1

3 months ago

1.2.0

6 months ago

1.1.1

6 months ago

1.1.0

6 months ago

1.0.4

6 months ago

1.0.3

7 months ago

1.0.2

7 months ago

1.0.1

7 months ago

1.0.0

7 months ago

0.0.8

7 months ago

0.0.7

7 months ago

0.0.6

7 months ago

0.0.5

7 months ago

0.0.4

7 months ago

0.0.3

7 months ago

0.0.2

7 months ago

0.0.1

7 months ago