Denoで標準入力を使って処理をする
Deno.icon Deno で一行ずつ取得して処理を実行するときは、標準モジュールの readLines を使う。 code:ts
for await (const line of readLines(Deno.stdin)) {
console.log({ line })
}
code:sh
$ echo -e "a\nb\nc" | deno run ./text.ts
{ line: "a" }
{ line: "b" }
{ line: "c" }
{ line: "" }