Bun 通過 Bun.stdout 屬性將 stdout 暴露為 BunFile。這可以用作 Bun.write() 的目標。
此代碼將文件寫入 stdout,類似於 Unix 中的 cat 命令。
ts
const path = "/path/to/file.txt";
const file = Bun.file(path);
await Bun.write(Bun.stdout, file);請參閱 文檔 > API > File I/O 獲取 Bun.write() 的完整文檔。