From 1694b64247d24feb9cf167b0a848ab9b25149961 Mon Sep 17 00:00:00 2001 From: Oj Date: Sat, 15 Jan 2022 11:29:22 +0000 Subject: [PATCH] [Poly > Yauzl] Cleanup code --- polyfills/yauzl.js | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/polyfills/yauzl.js b/polyfills/yauzl.js index a0431e8..ce4e70b 100644 --- a/polyfills/yauzl.js +++ b/polyfills/yauzl.js @@ -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(); }); }; \ No newline at end of file