[Poly > Yauzl] Cleanup code
This commit is contained in:
parent
bb6454da31
commit
1694b64247
1 changed files with 5 additions and 10 deletions
|
@ -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 { spawn } = require('child_process');
|
||||||
const { createReadStream, mkdirSync, rmdirSync } = require('original-fs');
|
const { mkdirSync } = require('fs');
|
||||||
const { join, basename } = require('path');
|
const { join, basename } = require('path');
|
||||||
|
|
||||||
exports.open = async (zipPath, _options, callback) => {
|
exports.open = async (zipPath, _options, callback) => {
|
||||||
|
@ -17,21 +17,17 @@ exports.open = async (zipPath, _options, callback) => {
|
||||||
listeners[event] = listener;
|
listeners[event] = listener;
|
||||||
},
|
},
|
||||||
|
|
||||||
readEntry: () => {},
|
readEntry: () => {}, // Stubs as not used
|
||||||
openReadStream: () => {},
|
openReadStream: () => {},
|
||||||
close: () => {}
|
close: () => {}
|
||||||
});
|
});
|
||||||
|
|
||||||
mkdirSync(extractPath, { recursive: true });
|
mkdirSync(extractPath, { recursive: true });
|
||||||
|
|
||||||
// const proc = spawn('tar', ['-v', '-xf', `"${zipPath.replaceAll('"', '')}"`, '-C', `"${extractPath}"`]);
|
|
||||||
const proc = spawn('unzip', ['-o', `${zipPath.replaceAll('"', '')}`, '-d', `${extractPath}`]);
|
const proc = spawn('unzip', ['-o', `${zipPath.replaceAll('"', '')}`, '-d', `${extractPath}`]);
|
||||||
console.log('spawn');
|
log('Yauzl', 'Spawned');
|
||||||
proc.stdout.on('data', (data) => {
|
|
||||||
});
|
|
||||||
|
|
||||||
proc.stderr.on('data', (data) => {
|
proc.stderr.on('data', (data) => {
|
||||||
console.log('stderr', data.toString());
|
|
||||||
errorOut(data.toString());
|
errorOut(data.toString());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -40,8 +36,7 @@ exports.open = async (zipPath, _options, callback) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
proc.on('close', async () => {
|
proc.on('close', async () => {
|
||||||
finishedExtract = true;
|
log('Yauzl', 'Closed');
|
||||||
console.log('close');
|
|
||||||
listeners.end();
|
listeners.end();
|
||||||
});
|
});
|
||||||
};
|
};
|
Loading…
Reference in a new issue