Created
September 10, 2020 10:50
-
-
Save sovietspy2/1970e843b561df253655483891665937 to your computer and use it in GitHub Desktop.
createReadStreamExample.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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