Back to Wails

Streams API Demo

v3/examples/web-apis/streams/frontend/index.html

2.13.01.3 KB
Original Source

Streams API Demo

The Streams API allows JavaScript to programmatically access streams of data, enabling efficient processing of large data sets chunk by chunk without loading everything into memory.

Streams API available: checking...

API Support

ReadableStream Demo

Create a custom ReadableStream that generates data chunks on demand.

Chunk count:Delay (ms): Start ReadableStreamCancel

Click "Start ReadableStream" to begin...

WritableStream Demo

Create a WritableStream that processes and logs each written chunk.

Text to write (each line becomes a chunk):Hello World This is chunk 2 Another chunk here Final chunk! Write to Stream Click "Write to Stream" to begin...

TransformStream Demo

Transform data as it flows through a stream pipeline.

Input text:

Transform type:UppercaseReverse CharactersDouble Each CharacterROT13 Cipher Transform Click "Transform" to see the result...

Pipe Chain Demo

Chain multiple transforms together using pipeThrough and pipeTo.

Input text: Run Pipe Chain

Pipeline: Input -> Split into chars -> Uppercase -> Add index -> Collect

Click "Run Pipe Chain" to see the result...

Fetch with Streams

Use streams to process fetch response body progressively.

URL to fetch: Fetch with StreamAbort

Click "Fetch with Stream" to begin...

Event Log

Clear Log

Ready to log stream events...