new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Deno · all subjects

cli/stdin

5 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Read stdin as ReadableStream

Deno.stdin exposes standard input as a web-standard ReadableStream. The easiest way to read all piped input as text is to wrap it in a Response: const input = await new Response(Deno.stdin.readable).text();

Deno.stdin.isTerminal() detects interactive vs piped input

Use Deno.stdin.isTerminal() to tell whether stdin is an interactive terminal or a pipe. This determines whether to print colors and progress bars (interactive) or plain machine-readable output (piped).

Reading stdin requires no permission flags

Reading stdin in Deno does not require any permission flags.

Node.js process.stdin works in Deno

Node-style process.stdin (from node:process or the process global) works in Deno, so Node.js CLI code that reads input runs unchanged.

Example: read stdin and detect TTY

let input: string; if (Deno.stdin.isTerminal()) { input = prompt("Enter some text:") ?? ""; } else { input = await new Response(Deno.stdin.readable).text(); } console.log(`Got ${input.trim().length} characters`);

Give your agent this brain