Reference · Files and processes

stdin

signature
stdin() -> str | error(str)

What it does

All that is piped to a script, as text, read to the end: cat rows.csv | quillo run tool.qwe. Nothing piped is "". With read_line a script reads a line at a time instead, and exit ends it with a status, which makes it a command-line tool.

Examples

in a program
// cat words.txt | quillo run count.qwelet words = split(trim(lower(stdin())), " ")print(len(words))

Edge cases

Errors

A program that serves is not a script: there, it is a runtime error, as the input is the terminal's and a request is not the one to read it.

in a program
route GET /x = stdin()    // a 500: `stdin` is for a script

Chaining

stdin() | split("\n") gives its lines.

See also

read_line, exit, args, read_file

Thread
2Useful? Like it, or add to its thread below.

Thread 0 posts

On stdin(): questions, tips, corrections, and code that uses it.

No posts yet. The first one opens the thread.

    Edit this page on GitHub · every example's output was made by running it (tools/refcheck.mjs) · questions on Discord or r/quillo