mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
24 lines
610 B
Plaintext
24 lines
610 B
Plaintext
---
|
|
title: Write to stdout
|
|
sidebarTitle: Write to stdout
|
|
mode: center
|
|
---
|
|
|
|
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()`](/runtime/file-io#writing-files-bun-write).
|
|
|
|
```ts
|
|
await Bun.write(Bun.stdout, "Lorem ipsum");
|
|
```
|
|
|
|
---
|
|
|
|
See [Docs > API > File I/O](/runtime/file-io#writing-files-bun-write) for complete documentation of `Bun.write()`.
|