pipeline
[accepts a function][1] which receives the source as an argument and expects it to return a promise or async iterator, and the Interface
object returned by Readline.createInterface
[can be used as an async iterator][2], so you can do this:
import { pipeline } from "node:stream";
import { createInterface } from "node:readline";
pipeline(
process.stdin,
(input) => createInterface({ input }),
process.stdout,