An asynchronous generator that yields chunks of data.
Optional response initialization options.
A Response object that streams the data.
Example usage:
import { start, router, stream } from "@pulsar-http/core";
const routes = [
router.get("/stream", async () => {
async function* dataGenerator() {
yield "Hello, ";
yield "World!";
}
return stream(dataGenerator());
}),
];
start({ routes });
In this example, the response will stream the data "Hello, World!".
Creates a response that streams data from an asynchronous generator.