const fs = require('fs')
// Create a readable stream for file.txt
fs.createReadStream('file.txt', 'utf8')
.on('data', chunk => {
// Print out each chunk that is read
console.log(chunk)
})
.on('end', () => {
// Print a message when the entire file has been read
console.log('Finished reading file')
})
-
Caleb C. Sander authoredb4b37ac0