@@ -2,23 +2,21 @@ import type { Agent as HttpAgent } from 'node:http'
22import type { Agent as HttpsAgent } from 'node:https'
33import os from 'node:os'
44import path from 'node:path'
5- import util from 'node:util'
6- import stream from 'node:stream'
5+ import { pipeline } from 'node:stream/promises'
76import fsp , { writeFile } from 'node:fs/promises'
87import zlib from 'node:zlib'
98
109import logger from '@wdio/logger'
11- import tar from 'tar-fs'
1210import { HttpsProxyAgent } from 'https-proxy-agent'
1311import { HttpProxyAgent } from 'http-proxy-agent'
12+ import { unpackTar } from 'modern-tar/fs'
1413
1514import { BINARY_FILE , GECKODRIVER_CARGO_YAML } from './constants.js'
1615import { hasAccess , getDownloadUrl , retryFetch } from './utils.js'
1716
1817import { BlobReader , BlobWriter , ZipReader } from '@zip.js/zip.js'
1918
2019const log = logger ( 'geckodriver' )
21- const streamPipeline = util . promisify ( stream . pipeline )
2220
2321const 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