Monday, December 12, 2016

Node.js Tutorial for Beginners 11 - Basics of Streams - Readable Stream





var fs = require('fs');

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

readStream.on('end', function(chunk) {
    console.log(data);
    console.log('--------------------End----------------------------------------');
})

Partner Sites

VideoToGifs.com

EasyOnlineConverter.com

SqliteTutorials.com


Stuff I use to make videos

Windows notebook - http://amzn.to/2ADOPrW

Apple MacBook Pro - http://amzn.to/2AC0WG2

Microphone - http://amzn.to/2AC1kV0

notebook mouse - http://amzn.to/2BmeZ2d