diff --git a/experimental/puppeteer-firefox/lib/BrowserFetcher.js b/experimental/puppeteer-firefox/lib/BrowserFetcher.js index a74e1c20313f8..3371f7ef5dd0d 100644 --- a/experimental/puppeteer-firefox/lib/BrowserFetcher.js +++ b/experimental/puppeteer-firefox/lib/BrowserFetcher.js @@ -289,13 +289,12 @@ function downloadFile(url, destinationPath, progressCallback) { * @param {string} folderPath * @return {!Promise} */ -function extractZip(zipPath, folderPath) { - return new Promise((fulfill, reject) => extract(zipPath, {dir: folderPath}, err => { - if (err) - reject(err); - else - fulfill(); - })); +async function extractZip(zipPath, folderPath) { + try { + await extract(zipPath, {dir: folderPath}); + } catch (error) { + return error; + } } function httpRequest(url, method, response) { diff --git a/package.json b/package.json index 1aceb8bfc6902..7048a6156a464 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "dependencies": { "@types/mime-types": "^2.1.0", "debug": "^4.1.0", - "extract-zip": "^1.6.6", + "extract-zip": "^2.0.0", "https-proxy-agent": "^4.0.0", "mime": "^2.0.3", "mime-types": "^2.1.25", @@ -48,7 +48,6 @@ }, "devDependencies": { "@types/debug": "0.0.31", - "@types/extract-zip": "^1.6.2", "@types/mime": "^2.0.0", "@types/node": "^10.17.14", "@types/rimraf": "^2.0.2", diff --git a/src/BrowserFetcher.js b/src/BrowserFetcher.js index f916fe73ae4e0..1e4ed336ba9e1 100644 --- a/src/BrowserFetcher.js +++ b/src/BrowserFetcher.js @@ -334,13 +334,12 @@ function install(archivePath, folderPath) { * @param {string} folderPath * @return {!Promise} */ -function extractZip(zipPath, folderPath) { - return new Promise((fulfill, reject) => extract(zipPath, {dir: folderPath}, err => { - if (err) - reject(err); - else - fulfill(); - })); +async function extractZip(zipPath, folderPath) { + try { + await extract(zipPath, {dir: folderPath}); + } catch (error) { + return error; + } } /** diff --git a/tsconfig.json b/tsconfig.json index a6825e4617008..815fab9b1be10 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,7 +3,8 @@ "allowJs": true, "checkJs": true, "outDir": "./lib", - "target": "ESNext" + "target": "ESNext", + "moduleResolution": "node" }, "include": [ "src"