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

# 写入到标准输出

`console.log` 函数会写入到 `stdout`。它会自动在打印的数据末尾追加换行符。

```ts theme={"theme":{"light":"github-light","dark":"dracula"}}
console.log("Lorem ipsum");
```

***

对于更高级的用例，Bun 通过 `Bun.stdout` 属性将 `stdout` 以 `BunFile` 形式暴露出来。它可以作为 [`Bun.write()`](/runtime/file-io#writing-files-bun-write) 的写入目标。

```ts theme={"theme":{"light":"github-light","dark":"dracula"}}
await Bun.write(Bun.stdout, "Lorem ipsum");
```

***

完整的 `Bun.write()` 文档请参见 [文档 > API > 文件 I/O](/runtime/file-io#writing-files-bun-write)。
