Skip to content

Latest commit

 

History

History

workers

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Example: Workers

This example demonstrates how to use piecemeal and have it generate a multipart response.

The example does leverage Workers KV;

If this doesn't work for you, have a try with a static iterable:
async function* get_data() {
  // Prints the letters of the alphabet A -> Z
  for (let letter = 65; letter <= 90; letter++) {
    // Purely to illustrate an artifical wait
    await new Promise((resolve) => setTimeout(resolve, 150));

    yield { letter: String.fromCharCode(letter) };
  }
}

Getting started

Setup

npm install

Start

wrangler dev

This setup does require wrangler — to setup head on over to the docs