edgedriver
Advanced tools
Comparing version 5.5.0 to 5.6.0
import path from 'node:path'; | ||
import fs from 'node:fs'; | ||
import fsp from 'node:fs/promises'; | ||
import fsp, { writeFile } from 'node:fs/promises'; | ||
import os from 'node:os'; | ||
import cp from 'node:child_process'; | ||
import { format } from 'node:util'; | ||
import { Readable } from 'node:stream'; | ||
import fetch from 'node-fetch'; | ||
import unzipper from 'unzipper'; | ||
import { BlobReader, BlobWriter, ZipReader } from '@zip.js/zip.js'; | ||
import findEdgePath from './finder.js'; | ||
@@ -35,3 +33,3 @@ import { TAGGED_VERSIONS, EDGE_PRODUCTS_API, TAGGED_VERSION_URL, LATEST_RELEASE_URL, DOWNLOAD_URL, BINARY_FILE, log } from './constants.js'; | ||
await fsp.mkdir(cacheDir, { recursive: true }); | ||
await downloadZip(res.body, cacheDir); | ||
await downloadZip(res, cacheDir); | ||
await fsp.chmod(binaryFilePath, '755'); | ||
@@ -132,14 +130,9 @@ log.info('Finished downloading Edgedriver'); | ||
} | ||
function downloadZip(body, cacheDir) { | ||
const stream = Readable.from(body).pipe(unzipper.Parse()); | ||
const promiseChain = [ | ||
new Promise((resolve, reject) => { | ||
stream.on('close', () => resolve()); | ||
stream.on('error', () => reject()); | ||
}) | ||
]; | ||
stream.on('entry', async (entry) => { | ||
const unzippedFilePath = path.join(cacheDir, entry.path); | ||
if (entry.type === 'Directory') { | ||
return; | ||
async function downloadZip(res, cacheDir) { | ||
const zipBlob = await res.blob(); | ||
const zip = new ZipReader(new BlobReader(zipBlob)); | ||
for (const entry of await zip.getEntries()) { | ||
const unzippedFilePath = path.join(cacheDir, entry.filename); | ||
if (entry.directory) { | ||
continue; | ||
} | ||
@@ -149,9 +142,5 @@ if (!await hasAccess(path.dirname(unzippedFilePath))) { | ||
} | ||
const execStream = entry.pipe(fs.createWriteStream(unzippedFilePath)); | ||
promiseChain.push(new Promise((resolve, reject) => { | ||
execStream.on('close', () => resolve(unzippedFilePath)); | ||
execStream.on('error', reject); | ||
})); | ||
}); | ||
return Promise.all(promiseChain); | ||
const content = await entry.getData(new BlobWriter()); | ||
await writeFile(unzippedFilePath, content.stream()); | ||
} | ||
} | ||
@@ -158,0 +147,0 @@ /** |
{ | ||
"name": "edgedriver", | ||
"version": "5.5.0", | ||
"version": "5.6.0", | ||
"description": "Microsofts' EdgeDriver for Node.js", | ||
@@ -50,3 +50,2 @@ "homepage": "https://webdriver.io", | ||
"@types/node": "^20.12.12", | ||
"@types/unzipper": "^0.10.9", | ||
"@typescript-eslint/eslint-plugin": "^7.9.0", | ||
@@ -72,5 +71,5 @@ "@typescript-eslint/parser": "^7.9.0", | ||
"node-fetch": "^3.3.2", | ||
"unzipper": "^0.11.6", | ||
"which": "^4.0.0" | ||
"which": "^4.0.0", | ||
"@zip.js/zip.js": "^2.7.44" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15
53923
582
+ Added@zip.js/zip.js@^2.7.44
+ Added@zip.js/zip.js@2.7.52(transitive)
- Removedunzipper@^0.11.6
- Removedbalanced-match@1.0.2(transitive)
- Removedbig-integer@1.6.52(transitive)
- Removedbluebird@3.4.7(transitive)
- Removedbrace-expansion@1.1.11(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removedcore-util-is@1.0.3(transitive)
- Removedduplexer2@0.1.4(transitive)
- Removedfs.realpath@1.0.0(transitive)
- Removedfstream@1.0.12(transitive)
- Removedglob@7.2.3(transitive)
- Removedgraceful-fs@4.2.11(transitive)
- Removedinflight@1.0.6(transitive)
- Removedinherits@2.0.4(transitive)
- Removedisarray@1.0.0(transitive)
- Removedminimatch@3.1.2(transitive)
- Removedminimist@1.2.8(transitive)
- Removedmkdirp@0.5.6(transitive)
- Removedonce@1.4.0(transitive)
- Removedpath-is-absolute@1.0.1(transitive)
- Removedprocess-nextick-args@2.0.1(transitive)
- Removedreadable-stream@2.3.8(transitive)
- Removedrimraf@2.7.1(transitive)
- Removedsafe-buffer@5.1.2(transitive)
- Removedstring_decoder@1.1.1(transitive)
- Removedunzipper@0.11.6(transitive)
- Removedutil-deprecate@1.0.2(transitive)
- Removedwrappy@1.0.2(transitive)