Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Response
Bun.serve({ port: 3000, fetch(req) { return new Response( // 一个异步生成器函数 async function* () { yield "Hello, "; await Bun.sleep(100); yield "world!"; // 你也可以 yield 一个 TypedArray 或 Buffer yield new Uint8Array(["\n".charCodeAt(0)]); }, { headers: { "Content-Type": "text/plain" } }, ); }, });
Bun.serve({ port: 3000, fetch(req) { return new Response( { [Symbol.asyncIterator]: async function* () { yield "Hello, "; await Bun.sleep(100); yield "world!"; }, }, { headers: { "Content-Type": "text/plain" } }, ); }, });