In this video we are going to learn about Writable Stream.
Streams are a way to handle reading/writing files, network communications, or any kind of end-to-end information exchange in an efficient way.
Using Writable: streams we can write data.
So let see how can we use writable stream.
So go to the project and inside the index.js file.
Require the http and fs packages.


var fs = require('http');
var fs = require('fs');
var readStream = fs.createReadStream(__dirname + '/message.txt','utf8');
var writeStream = fs.createWriteStream(__dirname + '/message2.txt');
readStream.on('data',function(chunk){
    console.log('new chunk recieved:');
    writeStream.write(chunk);
});



Now lets run this.
So goto the command prompt and here.
Just run the index.js file.


node index.js


Now go to the project and you can see here the another file message2 has been created now.
Inside the file you can see the text So in this way you can use Writable Stream in node js.