> ## Documentation Index
> Fetch the complete documentation index at: https://bun.ll1025.cn/llms.txt
> Use this file to discover all available pages before exploring further.

# 将文件写入标准输出

Bun 通过 `Bun.stdout` 属性将 `stdout` 暴露为 `BunFile`。将其作为目标传递给 [`Bun.write()`](/runtime/file-io#writing-files-bun-write)。

以下代码将文件写入 `stdout`，类似于 Unix 的 `cat` 命令。

```ts cat.ts icon="https://mintcdn.com/span-inc/82N53aP7NFbaCVSl/icons/typescript.svg?fit=max&auto=format&n=82N53aP7NFbaCVSl&q=85&s=787d39d6a7d96d7f9540dc74344eba23" theme={null}
const path = "/path/to/file.txt";
const file = Bun.file(path);
await Bun.write(Bun.stdout, file);
```

***

参见 [`Bun.write()`](/runtime/file-io#writing-files-bun-write)。
