1. Raw stdout write
process.stdout.write sends bytes verbatim with no added newline, unlike console.log.
process.stdout.write("no trailing newline")Typorithm · medium
Step 1 of 8 · intro card
CLI & Process
process.stdout.write sends raw bytes; console.log is a wrapper that formats and adds a newline. process.stdin is a Readable stream you can read piped input from. Send diagnostics to stderr so they don't pollute piped stdout, and check process.stdout.isTTY to detect whether output is an interactive terminal.
process.stdout.write outputs raw text with no trailing newline, while console.log is a convenience wrapper that formats its arguments and appends a newline — use write when you need precise control over the bytes.
process.stdin is a Readable stream, so listening for its "data" event lets your program consume input piped in from another command, the foundation of Unix-style filters.
Send diagnostics and logs to process.stderr so they stay separate from the program's real output on stdout — that way piping stdout to a file or another command stays clean — and check process.stdout.isTTY to tell whether you're writing to an interactive terminal (true) or a pipe/file (false), e.g. to disable colors.
console.log wraps stdout.write and adds a newline.
process.stdin is a Readable stream for piped input.
stderr for diagnostics; isTTY detects a real terminal.
process.stdout.write("no trailing newline")
console.log("adds a newline") // shorthand for stdout
process.stdin.on("data", (chunk) => process.stdout.write(chunk))
process.stderr.write("diagnostic\n") // keeps stdout clean for pipes
if (process.stdout.isTTY) showColors() // false when piped to a fileConnect each part of the code to the concept before you type.
process.stdout.write sends bytes verbatim with no added newline, unlike console.log.
process.stdout.write("no trailing newline")console.log is a convenience wrapper over process.stdout.write that formats arguments and appends a newline.
console.log("adds a newline") // shorthand for stdoutprocess.stdin is a Readable stream; listening for "data" lets you consume input piped into the program.
process.stdin.on("data", (chunk) => process.stdout.write(chunk))Writing logs to stderr keeps them out of stdout, so piping the program's real output stays clean.
process.stderr.write("diagnostic\n") // keeps stdout clean for pipesprocess.stdout.isTTY is true only when output goes to an interactive terminal, so you can disable colors when piped.
if (process.stdout.isTTY) showColors() // false when piped to a fileRead the concept map and follow the code breakdown.
Type the implementation, repair mistakes and work through every recall exercise.
Use the final check without hints; revisit weak concepts in short practice sessions.