Skip to main content

Write a file to stdout

还没翻译译自英文(bun.com)本页 4 段都还没译

Bun exposes stdout as a BunFile with the Bun.stdout property. Pass it as the destination to Bun.write().

The following code writes a file to stdout, like the Unix cat command.

const path = "/path/to/file.txt";
const file = Bun.file(path);
await Bun.write(Bun.stdout, file);

See Bun.write().

번역 © 2026 fanyi.dev · 원문 © 2026 the Bun project (LICENSE.md names no copyright holder) (MIT)