本页还没有译文
本页 3 段还没译成日本語,下面显示的是英文原文。Streaming HTTP Server with Node.js Streams
还没翻译译自英文(bun.com)本页 3 段都还没译
In Bun, a Response accepts a Node.js Readable as its body.
This works because Bun's Response accepts any async iterable as its body, and Node.js streams are async iterables.
import { Readable } from "stream";
import { serve } from "bun";
serve({
port: 3000,
fetch(req) {
return new Response(Readable.from(["Hello, ", "world!"]), {
headers: { "Content-Type": "text/plain" },
});
},
});AI 翻译查看英文原文