[Poly > Yauzl] Minor source cleanup
This commit is contained in:
parent
2ed61b67f6
commit
61d0f3a2ab
1 changed files with 5 additions and 6 deletions
|
@ -1,10 +1,9 @@
|
||||||
// Jank replacement for yauzl by just using unzip where it expects and skipping (speed++, size--, jank++)
|
// Jank replacement for yauzl by just using unzip where it expects and skipping (speed++, size--, jank++)
|
||||||
const { execFile } = require('child_process');
|
const { execFile } = require('child_process');
|
||||||
const { mkdirSync } = require('fs');
|
const mkdirp = require('mkdirp');
|
||||||
const { join, basename } = require('path');
|
|
||||||
|
|
||||||
exports.open = async (zipPath, _options, callback) => {
|
exports.open = async (zipPath, _opts, callback) => {
|
||||||
const extractPath = join(global.moduleDataPath, basename(zipPath).split('.')[0].split('-')[0]);
|
const extractPath = `${global.moduleDataPath}/${zipPath.split('/').pop().split('.')[0].split('-')[0])}`;
|
||||||
const listeners = [];
|
const listeners = [];
|
||||||
|
|
||||||
const errorOut = (err) => {
|
const errorOut = (err) => {
|
||||||
|
@ -21,9 +20,9 @@ exports.open = async (zipPath, _options, callback) => {
|
||||||
close: () => {}
|
close: () => {}
|
||||||
});
|
});
|
||||||
|
|
||||||
mkdirSync(extractPath, { recursive: true });
|
mkdirp.sync(extractPath);
|
||||||
|
|
||||||
const proc = execFile('unzip', ['-q', '-o', zipPath.replaceAll('"', ''), '-d', extractPath]);
|
const proc = execFile('unzip', ['-q', '-o', zipPath, '-d', extractPath]);
|
||||||
|
|
||||||
proc.stderr.on('data', errorOut);
|
proc.stderr.on('data', errorOut);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue