15 lines
535 B
TypeScript
15 lines
535 B
TypeScript
|
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);
|