aboutsummaryrefslogtreecommitdiff
path: root/docs/guides/write-file/stdout.md
blob: 00fa11a60733331b98f0c180631bb894d748ab14 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
---
name: Write to stdout
---

The `console.log` function writes to `stdout`. It will automatically append a line break at the end of the printed data.

```ts
console.log("Lorem ipsum");
```

---

For more advanced use cases, Bun exposes `stdout` as a `BunFile` via the `Bun.stdout` property. This can be used as a destination for [`Bun.write()`](/docs/api/file-io#writing-files-bun-write).

```ts
await Bun.write(Bun.stdout, "Lorem ipsum");
```

---

See [Docs > API > File I/O](/docs/api/file-io#writing-files-bun-write) for complete documentation of `Bun.write()`.