|
|
|
@ -1,6 +1,6 @@
|
|
|
|
|
// Jank replacement for yauzl by just using unzip where it expects and skipping (speed++, size--)
|
|
|
|
|
// Jank replacement for yauzl by just using unzip where it expects and skipping (speed++, size--, jank++)
|
|
|
|
|
const { spawn } = require('child_process');
|
|
|
|
|
const { createReadStream, mkdirSync, rmdirSync } = require('original-fs');
|
|
|
|
|
const { mkdirSync } = require('fs');
|
|
|
|
|
const { join, basename } = require('path');
|
|
|
|
|
|
|
|
|
|
exports.open = async (zipPath, _options, callback) => {
|
|
|
|
@ -17,21 +17,17 @@ exports.open = async (zipPath, _options, callback) => {
|
|
|
|
|
listeners[event] = listener;
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
readEntry: () => {},
|
|
|
|
|
readEntry: () => {}, // Stubs as not used
|
|
|
|
|
openReadStream: () => {},
|
|
|
|
|
close: () => {}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
mkdirSync(extractPath, { recursive: true });
|
|
|
|
|
|
|
|
|
|
// const proc = spawn('tar', ['-v', '-xf', `"${zipPath.replaceAll('"', '')}"`, '-C', `"${extractPath}"`]);
|
|
|
|
|
const proc = spawn('unzip', ['-o', `${zipPath.replaceAll('"', '')}`, '-d', `${extractPath}`]);
|
|
|
|
|
console.log('spawn');
|
|
|
|
|
proc.stdout.on('data', (data) => {
|
|
|
|
|
});
|
|
|
|
|
log('Yauzl', 'Spawned');
|
|
|
|
|
|
|
|
|
|
proc.stderr.on('data', (data) => {
|
|
|
|
|
console.log('stderr', data.toString());
|
|
|
|
|
errorOut(data.toString());
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
@ -40,8 +36,7 @@ exports.open = async (zipPath, _options, callback) => {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
proc.on('close', async () => {
|
|
|
|
|
finishedExtract = true;
|
|
|
|
|
console.log('close');
|
|
|
|
|
log('Yauzl', 'Closed');
|
|
|
|
|
listeners.end();
|
|
|
|
|
});
|
|
|
|
|
};
|