diff --git a/modules/item/back/methods/item-image-queue/downloadImages.js b/modules/item/back/methods/item-image-queue/downloadImages.js index 08e5df050..c4d7f4b98 100644 --- a/modules/item/back/methods/item-image-queue/downloadImages.js +++ b/modules/item/back/methods/item-image-queue/downloadImages.js @@ -59,17 +59,10 @@ module.exports = Self => { } const writeStream = fs.createWriteStream(filePath); - writeStream.on('open', () => { - response.pipe(writeStream); - }); - - writeStream.on('error', async error => { - await errorHandler(image.itemFk, error, filePath); - }); - - writeStream.on('finish', async function() { - writeStream.end(); - }); + writeStream.on('open', () => response.pipe(writeStream)); + writeStream.on('error', async error => + await errorHandler(image.itemFk, error, filePath)); + writeStream.on('finish', writeStream.end()); writeStream.on('close', async function() { try {