Home » » Node.Js Tutorial For Beginners Eleven - Basics Of Streams - Readable Stream

Node.Js Tutorial For Beginners Eleven - Basics Of Streams - Readable Stream





var fs = require('fs');  var readStream = fs.createReadStream('file.txt'); readStream.setEncoding('utf8'); var information = ''; readStream.on('data', function(chunk) {     console.log('------------------------------------------------------------');     information += chunk;     //console.log(chunk); })  readStream.on('end', function(chunk) {     console.log(data);     console.log('--------------------End----------------------------------------'); }) 

0 comments:

Post a Comment

Search