Home » » Node.Js Tutorial For Beginners 12 - Basics Of Streams - Writable Streams

Node.Js Tutorial For Beginners 12 - Basics Of Streams - Writable Streams



var fs = require('fs');  var readStream = fs.createReadStream('file.txt'); readStream.setEncoding('utf8'); var writeStream = fs.createWriteStream('write_file.txt');  readStream.on('data', function(chunk) {     console.log('------------------------------------------------------------');     writeStream.write(chunk); })  readStream.on('end', function(chunk) {      console.log('--------------------End----------------------------------------'); }) 

0 comments:

Post a Comment

Search