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

React -1 ( react with ravenndra kanchi)

 react with tool chanis 45 to 50 sessions core  after 50 sessions -> some tooll chains == react with type script mern stackaplication in ...