Skip to content

Commit bea9393

Browse files
authored
chore(install): use modern tar to unpack (#681)
1 parent f7d35dd commit bea9393

File tree

3 files changed

+30
-31
lines changed

3 files changed

+30
-31
lines changed

package-lock.json

Lines changed: 26 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@
5959
},
6060
"devDependencies": {
6161
"@types/node": "^24.3.0",
62-
"@types/tar-fs": "^2.0.4",
6362
"@vitest/coverage-v8": "^3.0.2",
6463
"@wdio/eslint": "^0.1.2",
6564
"eslint": "^9.16.0",
@@ -81,6 +80,6 @@
8180
"decamelize": "^6.0.0",
8281
"http-proxy-agent": "^7.0.2",
8382
"https-proxy-agent": "^7.0.5",
84-
"tar-fs": "^3.1.0"
83+
"modern-tar": "^0.3.4"
8584
}
8685
}

src/install.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,21 @@ import type { Agent as HttpAgent } from 'node:http'
22
import type { Agent as HttpsAgent } from 'node:https'
33
import os from 'node:os'
44
import path from 'node:path'
5-
import util from 'node:util'
6-
import stream from 'node:stream'
5+
import { pipeline } from 'node:stream/promises'
76
import fsp, { writeFile } from 'node:fs/promises'
87
import zlib from 'node:zlib'
98

109
import logger from '@wdio/logger'
11-
import tar from 'tar-fs'
1210
import { HttpsProxyAgent } from 'https-proxy-agent'
1311
import { HttpProxyAgent } from 'http-proxy-agent'
12+
import { unpackTar } from 'modern-tar/fs'
1413

1514
import { BINARY_FILE, GECKODRIVER_CARGO_YAML } from './constants.js'
1615
import { hasAccess, getDownloadUrl, retryFetch } from './utils.js'
1716

1817
import { BlobReader, BlobWriter, ZipReader } from '@zip.js/zip.js'
1918

2019
const log = logger('geckodriver')
21-
const streamPipeline = util.promisify(stream.pipeline)
2220

2321
const fetchOpts: RequestInit & {
2422
agent?: HttpAgent | HttpsAgent | InstanceType<typeof HttpsProxyAgent> | InstanceType<typeof HttpProxyAgent>
@@ -63,7 +61,7 @@ export async function download (
6361
await fsp.mkdir(cacheDir, { recursive: true })
6462
await (url.endsWith('.zip')
6563
? downloadZip(res, cacheDir)
66-
: streamPipeline(res.body, zlib.createGunzip(), tar.extract(cacheDir)))
64+
: pipeline(res.body, zlib.createGunzip(), unpackTar(cacheDir)))
6765

6866
await fsp.chmod(binaryFilePath, '755')
6967
return binaryFilePath

0 commit comments

Comments
 (0)