parent
c6f580faf8
commit
949dc7b514
|
|
@ -44,7 +44,7 @@
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"debug": "^4.1.0",
|
"debug": "^4.1.0",
|
||||||
"extract-zip": "^1.6.6",
|
"extract-zip": "^2.0.0",
|
||||||
"https-proxy-agent": "^3.0.0",
|
"https-proxy-agent": "^3.0.0",
|
||||||
"jpeg-js": "^0.3.6",
|
"jpeg-js": "^0.3.6",
|
||||||
"mime": "^2.4.4",
|
"mime": "^2.4.4",
|
||||||
|
|
|
||||||
|
|
@ -145,7 +145,7 @@ export async function downloadBrowser(options: DownloadOptions): Promise<void> {
|
||||||
const zipPath = path.join(os.tmpdir(), `playwright-download-${browser}-${platform}-${revision}.zip`);
|
const zipPath = path.join(os.tmpdir(), `playwright-download-${browser}-${platform}-${revision}.zip`);
|
||||||
try {
|
try {
|
||||||
await downloadFile(url, zipPath, progress);
|
await downloadFile(url, zipPath, progress);
|
||||||
await extractZip(zipPath, downloadPath);
|
await extract(zipPath, {dir: downloadPath});
|
||||||
} finally {
|
} finally {
|
||||||
if (await existsAsync(zipPath))
|
if (await existsAsync(zipPath))
|
||||||
await unlinkAsync(zipPath);
|
await unlinkAsync(zipPath);
|
||||||
|
|
@ -211,15 +211,6 @@ function downloadFile(url: string, destinationPath: string, progressCallback: On
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function extractZip(zipPath: string, folderPath: string): Promise<Error | null> {
|
|
||||||
return new Promise((fulfill, reject) => extract(zipPath, {dir: folderPath}, err => {
|
|
||||||
if (err)
|
|
||||||
reject(err);
|
|
||||||
else
|
|
||||||
fulfill();
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
function httpRequest(url: string, method: string, response: (r: any) => void) {
|
function httpRequest(url: string, method: string, response: (r: any) => void) {
|
||||||
let options: any = URL.parse(url);
|
let options: any = URL.parse(url);
|
||||||
options.method = method;
|
options.method = method;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue