ssn/src/inflateFile.ts

15 lines
543 B
TypeScript
Raw Normal View History

2018-07-08 22:59:31 +02:00
import * as fs from 'fs';
import * as zlib from 'zlib';
const fileReadStream = fs.createReadStream('/tmp/patcher/Assets/swtor_de-de_area_alderaan_1.tor');
2018-07-08 22:59:31 +02:00
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');
2018-07-08 22:59:31 +02:00
fileReadStream.pipe(decompressTransform).pipe(fileWriteStream);