Created
March 28, 2019 15:24
-
-
Save Rotron/eb2fdac7cb9a2f1c6437692c5ead4556 to your computer and use it in GitHub Desktop.
Revisions
-
ederavilaprado revised this gist
Mar 17, 2017 . 1 changed file with 7 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,9 +1,9 @@ var crypto = require('crypto'); var fs = require('fs'); var wstream = fs.createWriteStream('myBinaryFile'); // creates random Buffer of 100 bytes var buffer = crypto.randomBytes(100); wstream.write(buffer); // create another Buffer of 100 bytes and write wstream.write(crypto.randomBytes(100)); wstream.end(); -
ederavilaprado created this gist
Mar 17, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,9 @@ var fs = require('fs'); var wstream = fs.createWriteStream('myOutput.txt'); // Node.js 0.10+ emits finish when complete wstream.on('finish', function () { console.log('file has been written'); }); wstream.write('Hello world!\n'); wstream.write('Another line'); wstream.end();