Skip to content

Instantly share code, notes, and snippets.

@Mayankgupta688
Created April 11, 2020 09:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mayankgupta688/e5759253125b9d89b9f6c9682b5c99d0 to your computer and use it in GitHub Desktop.
Save Mayankgupta688/e5759253125b9d89b9f6c9682b5c99d0 to your computer and use it in GitHub Desktop.
var fs = require('fs');
var readableStream = fs.createReadStream('largeFile.html');
var writableStream = fs.createWriteStream('copiedFile.html');
readableStream.setEncoding('utf8');
readableStream.on('data', function(chunk) {
writableStream.write(chunk);
});
readableStream.on('end', function(chunk) {
console.log("File Content Copied...")
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment