From a07d719d4fc64f578cb2561f1ffb9cfa4f6e1357 Mon Sep 17 00:00:00 2001 From: C-3PO Date: Sun, 8 Jul 2018 22:59:31 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A7=20manually=20decompress=20file=20t?= =?UTF-8?q?o=20debug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/inflateFile.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/inflateFile.ts diff --git a/src/inflateFile.ts b/src/inflateFile.ts new file mode 100644 index 0000000..46c7ae7 --- /dev/null +++ b/src/inflateFile.ts @@ -0,0 +1,14 @@ +import * as fs from 'fs'; +import * as zlib from 'zlib'; + +const fileReadStream = fs.createReadStream('/tmp/patcher/Assets/swtor_de-de_area_raid_1.tor'); + +const decompressTransform = zlib.createInflateRaw(); +decompressTransform.on('error', (error) => { + //TODO: need to throw error sync, not async + throw new Error(`Error during decompression: ${error.message}`); +}); + +const fileWriteStream = fs.createWriteStream('/tmp/patcher/Assets/swtor_de-de_area_raid_1.tor.raw'); + +fileReadStream.pipe(decompressTransform).pipe(fileWriteStream);