Reading streams with promises in Node.js

1 · Nicholas C. Zakas · May 13, 2019, midnight
If you’ve tried to use the Node.js fs.promises API, you might have noticed that there doesn’t appear to be a cross-platform way of using fs.readFile() to read from process.stdin (such as process.stdin). Using the old, callback-based API, you could pass in a numeric file descriptor, such as: import fs from "fs"; const text = fs.readFileSync(0,......