Files
bun.sh/docs/guides/write-file/cat.md
2024-09-10 15:11:16 -07:00

545 B

name
name
Write a file to stdout

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.

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().