Browse Source

Улучшение обработки ошибок в gzipFile

Book Pauk 2 years ago
parent
commit
9f67b3bf28
1 changed files with 4 additions and 1 deletions
  1. 4 1
      server/core/utils.js

+ 4 - 1
server/core/utils.js

@@ -105,7 +105,10 @@ function gzipFile(inputFile, outputFile, level = 1) {
         const input = fs.createReadStream(inputFile);
         const output = fs.createWriteStream(outputFile);
 
-        input.pipe(gzip).pipe(output).on('finish', (err) => {
+        input.on('error', reject)
+            .pipe(gzip).on('error', reject)
+            .pipe(output).on('error', reject)
+            .on('finish', (err) => {
             if (err) reject(err);
             else resolve();
         });