std/io
The three streams every process is started with. They are ordinary Source and Sink values (docs/design/STREAMS.md),
so everything that reads a file reads standard input, and everything that writes a file writes to the screen:
const total = lines().count().await()?
standardOutput().addLine("{total} lines").await()?
print/printError of the prelude and readLine() here stay as the short form for the common case: a program that
prints a line does not want to think about a stream.
Modules
std/io/libThe three streams every process is started with.
Everything
- fn
linesThe lines of standard input, as a stream: the same stageFile.linesuses, over the same kind of source. - fn
readLineThe next line of standard input without its line break:Ok(None)at the end of the input, and anIoErrorfor a line whose bytes are not UTF-8. - fn
standardErrorStandard error, unbuffered for the reason it is everywhere: a diagnostic that is lost is worse than a slow one. - fn
standardInputStandard input as a stream of byte chunks, each read on a thread of the blocking pool as it arrives. - fn
standardOutputStandard output as a stream of byte chunks.