From f50e71b53a3aceda3e6c17d796b6d1caaed9c27d Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Sat, 7 May 2016 17:04:02 +0200 Subject: [PATCH] normalize style for #57 --- README.md | 40 ++++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 87384ea..3fb8418 100644 --- a/README.md +++ b/README.md @@ -131,34 +131,30 @@ pack.pipe(newTarballStream) ``` js -var fs = require('fs'); -var tar = require('tar-stream'); +var fs = require('fs') +var tar = require('tar-stream') -var pack = tar.pack(); // pack is a streams2 stream -var path = 'YourTarBall.tar'; -var yourTarball = fs.createWriteStream(path); +var pack = tar.pack() // pack is a streams2 stream +var path = 'YourTarBall.tar' +var yourTarball = fs.createWriteStream(path) // add a file called YourFile.txt with the content "Hello World!" -pack.entry({ - name: 'YourFile.txt' -}, 'Hello World!', () => { - pack.finalize(); -}); +pack.entry({name: 'YourFile.txt'}, 'Hello World!', function (err) { + if (err) throw err + pack.finalize() +}) // pipe the pack stream to your file -pack.pipe(yourTarball); - -yourTarball.on('close', () => { - console.log(path + ' has been written'); - fs.stat(path, function(err, stats) { - if (err) { - return console.error(err); - } - console.log(stats); - console.log("Got file info successfully!"); - }); -}); +pack.pipe(yourTarball) +yourTarball.on('close', function () { + console.log(path + ' has been written') + fs.stat(path, function(err, stats) { + if (err) throw err + console.log(stats) + console.log('Got file info successfully!') + }) +}) ``` ## Performance