diff --git a/libs/resize.js b/libs/resize.js index 24ba3bf..0f70d9e 100644 --- a/libs/resize.js +++ b/libs/resize.js @@ -24,15 +24,17 @@ class Resize { return false } - resizeImg(data, this.size).then(buf => { - fs.writeFile(output, buf, (err) => { - if (err) { - callback(err, null) - return false - } - callback(null, { input: input, output: output, size: this.size }) + resizeImg(data, this.size) + .then(buf => { + fs.writeFile(output, buf, (err) => { + if (err) { + callback(err, null) + return false + } + callback(null, { input: input, output: output, size: this.size }) + }) }) - }) + .catch(callback) }) }