2018-07-08 22:59:31 +02:00
|
|
|
import * as fs from 'fs';
|
|
|
|
import * as zlib from 'zlib';
|
|
|
|
|
2018-07-08 23:07:34 +02:00
|
|
|
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}`);
|
|
|
|
});
|
|
|
|
|
2018-07-08 23:07:34 +02:00
|
|
|
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);
|