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

create cartoon video using ai

  https://www.piclumen.com/ using this we can crate cartoon photos https://hailuoai.video/ its not free upto 1000 points we canuse it for fr...