From 523f306ab368b31410fe88e3dd7a1a68753483cb Mon Sep 17 00:00:00 2001 From: C-3PO Date: Sat, 23 Jun 2018 22:48:17 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Check=20for=20error=20after=20zl?= =?UTF-8?q?ib=20uncompression?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ssn/extractFile.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ssn/extractFile.ts b/src/ssn/extractFile.ts index e96fda5..b52382f 100644 --- a/src/ssn/extractFile.ts +++ b/src/ssn/extractFile.ts @@ -61,8 +61,11 @@ export default async function extractFile(file: ISsnFileEntry, dvArray: DataView } //uncompress file - const uncompressedBuffer: Buffer = await new Promise((resolve) => { + const uncompressedBuffer: Buffer = await new Promise((resolve, reject) => { zlib.inflateRaw(dvFinal, (error, result) => { + if (error !== null) { + reject(error); + } resolve(result); }); }) as Buffer;