Skip to content

Instantly share code, notes, and snippets.

@sovietspy2
Created September 10, 2020 10:50
Show Gist options
  • Select an option

  • Save sovietspy2/1970e843b561df253655483891665937 to your computer and use it in GitHub Desktop.

Select an option

Save sovietspy2/1970e843b561df253655483891665937 to your computer and use it in GitHub Desktop.
createReadStreamExample.js
const { createReadStream } = require("fs");
async function run() {
const stream = createReadStream("./test.txt",{ highWaterMark: 4 });
console.log("start")
for await (let chunk of stream) {
console.log(chunk.toString('utf-8'));
}
console.log("done")
}
run();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment