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

server laravel application

 asset_url = domain/public chmod -R 755 public/admin/ composer dump-autoload get the application from hostinger