ssn/src/inflateFile.ts

14 lines
543 B
TypeScript

import * as fs from 'fs';
import * as zlib from 'zlib';
const fileReadStream = fs.createReadStream('/tmp/patcher/Assets/swtor_de-de_area_alderaan_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_alderaan_1.tor.raw');
fileReadStream.pipe(decompressTransform).pipe(fileWriteStream);