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-farm-a91c5779-shell-sandbox/CFA6Tagw86uhJFhY/icons/typescript.svg?fit=max&auto=format&n=CFA6Tagw86uhJFhY&q=85&s=b76cf0e4a2c188862bc272cae1c4e52fcat.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().