From a3bff814ef298e08961fc82363fcd8e73383a457 Mon Sep 17 00:00:00 2001 From: C-3PO Date: Wed, 4 Jul 2018 19:57:55 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=97=91=20Remove=20debug=20message?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/cdn/getUrlContents.ts | 3 ++- src/ssn/extractFile.ts | 2 +- src/ssn/reader/readSsnFile.ts | 6 +++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/cdn/getUrlContents.ts b/src/cdn/getUrlContents.ts index d87a925..ee1228b 100644 --- a/src/cdn/getUrlContents.ts +++ b/src/cdn/getUrlContents.ts @@ -13,8 +13,9 @@ export default function getUrlContents({ host, path }: {host: string, path: stri //In case of connection errors, exit early request.on('error', (error) => { request.abort(); - return reject(error); + reject(error); }); + request.end(); }); } diff --git a/src/ssn/extractFile.ts b/src/ssn/extractFile.ts index 7a38c00..33e3605 100644 --- a/src/ssn/extractFile.ts +++ b/src/ssn/extractFile.ts @@ -31,7 +31,6 @@ export default async function extractFile(file: ISsnFileEntry, dvArray: DataView //Decompress file const decompressedBuffer: Buffer = await new Promise((resolve, reject) => { - console.log(new Uint8Array(dvFinal.buffer)); zlib.inflateRaw(dvFinal, (error, result) => { if (error !== null) { return reject(error); @@ -39,5 +38,6 @@ export default async function extractFile(file: ISsnFileEntry, dvArray: DataView resolve(result); }); }) as Buffer; + return decompressedBuffer.buffer as ArrayBuffer; } diff --git a/src/ssn/reader/readSsnFile.ts b/src/ssn/reader/readSsnFile.ts index aaa3092..0601a81 100644 --- a/src/ssn/reader/readSsnFile.ts +++ b/src/ssn/reader/readSsnFile.ts @@ -91,8 +91,8 @@ export default function readSsnFile(buffer: ArrayBuffer): ISsnFileEntry[] { const fileCrc = dv.getUint32(pos, true); pos += 4; /** compressed size */ const comprSize = dv.getUint32(pos, true); pos += 4; - /** uncompressed size */ - const uncomprSize = dv.getUint32(pos, true); pos += 4; + /** decompressed size */ + const decomprSize = dv.getUint32(pos, true); pos += 4; /** file name length */ const fileNameLength = dv.getUint16(pos, true); pos += 2; /** extra field length */ @@ -158,7 +158,7 @@ export default function readSsnFile(buffer: ArrayBuffer): ISsnFileEntry[] { offset: (centralDirOffset > 0) ? //If files are included in this archive, the centralDirOffset will not start from the beginning posCentralDirStart - centralDirOffset + relOffset : //if file is in this archive relOffset, //if we need to look in a disk (e.g. .z01 for this file) - size: uncomprSize, + size: decomprSize, }; //If file is encrypted