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);