Skip to main content
In Bun, the console object is an AsyncIterable that yields lines from stdin.
index.ts

Running this file starts a never-ending interactive prompt that echoes whatever you type.
terminal

Bun also exposes stdin as a BunFile, Bun.stdin. Use it to incrementally read large inputs piped into the bun process. Chunks aren’t guaranteed to be split line-by-line.
stdin.ts

Running stdin.ts prints whatever is piped into it.
terminal

See Utils for more utilities.