From df3df26ed2e0fd322a4abef8e89e73a0258b0fa7 Mon Sep 17 00:00:00 2001 From: Richard Girges Date: Fri, 17 Feb 2017 09:40:29 -0800 Subject: [PATCH] Fixes #19. Callback in `mv` method is optional --- lib/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/index.js b/lib/index.js index e57d106..6446dd5 100644 --- a/lib/index.js +++ b/lib/index.js @@ -49,8 +49,6 @@ module.exports = function(options) { safeFileNameRegex = options.safeFileNames; filename = filename.replace(safeFileNameRegex, ''); - - console.log('filename yo', filename); } var newFile = { @@ -63,10 +61,12 @@ module.exports = function(options) { fstream = fs.createWriteStream(path); streamifier.createReadStream(buf).pipe(fstream); fstream.on('error', function(error) { - callback(error); + if (callback) + callback(error); }); fstream.on('close', function() { - callback(null); + if (callback) + callback(null); }); } };