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); }); } };