streams in nodejs | nodejs tutorials

 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

Event listening in react

 How we can listen to som eevents some envents fire like click or automatically user enters into input button , that is event on word type i...