Skip to main content
Bun exposes stdout as a BunFile with the Bun.stdout property. This can be used as a destination for Bun.write(). This code writes a file to stdout similar to the cat command in Unix.
https://mintcdn.com/bun-1dd33a4e-claude-spawn-pty-support/QoBJ_wda4qs1OZ4-/icons/typescript.svg?fit=max&auto=format&n=QoBJ_wda4qs1OZ4-&q=85&s=7e69f1d0981fed9617c1ae7f85ad9758cat.ts
const path = "/path/to/file.txt";
const file = Bun.file(path);
await Bun.write(Bun.stdout, file);

See Docs > API > File I/O for complete documentation of Bun.write().