Fix downloadAndExtract to resolve on finish

This commit is contained in:
Sparticuz 2023-01-13 10:16:37 -05:00
parent 9e34256b2f
commit 083fd747ff
1 changed files with 1 additions and 3 deletions

View File

@ -18,10 +18,8 @@ export const downloadAndExtract = async (url: string) =>
get(url, (response) => { get(url, (response) => {
response.pipe(extractObj); response.pipe(extractObj);
extractObj.on('finish', () => { extractObj.on('finish', () => {
extractObj.end(() => {
resolve(destDir); resolve(destDir);
}); });
});
}).on('error', (err) => { }).on('error', (err) => {
unlink(destDir, (_) => { unlink(destDir, (_) => {
reject(err) reject(err)