streams
writeable
readabvle
duplex
transform
its like read and write
const {createReadStream} = require('fs');
const stream = createReadStream('./content/big.txt')
if file not there , it will create
stream.on('data', ()=>{})
stream.on('data', (result)=>{ console.log(result)})
after file create, read the data
default buffer size is 64kb
const stream = createReadStream('./content/big.txt',{highwatermark:90000})
const stream = createReadStream('./content/big.txt',{encoding:'utf8'})
No comments:
Post a Comment