diff --git a/packages/artifact/package-lock.json b/packages/artifact/package-lock.json index 26967402..472e06bc 100644 --- a/packages/artifact/package-lock.json +++ b/packages/artifact/package-lock.json @@ -18,11 +18,13 @@ "@octokit/plugin-retry": "^3.0.9", "@octokit/request-error": "^5.0.0", "@protobuf-ts/plugin": "^2.2.3-alpha.1", + "@types/unzip-stream": "^0.3.4", "@types/unzipper": "^0.10.6", "archiver": "^5.3.1", "crypto": "^1.0.1", "jwt-decode": "^3.1.2", "twirp-ts": "^2.5.0", + "unzip-stream": "^0.3.1", "unzipper": "^0.10.14" }, "devDependencies": { @@ -471,6 +473,14 @@ "@types/node": "*" } }, + "node_modules/@types/unzip-stream": { + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/@types/unzip-stream/-/unzip-stream-0.3.4.tgz", + "integrity": "sha512-ud0vtsNRF+joUCyvNMyo0j5DKX2Lh/im+xVgRzBEsfHhQYZ+i4fKTveova9XxLzt6Jl6G0e/0mM4aC0gqZYSnA==", + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/unzipper": { "version": "0.10.6", "resolved": "https://registry.npmjs.org/@types/unzipper/-/unzipper-0.10.6.tgz", @@ -1513,6 +1523,15 @@ "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.0.tgz", "integrity": "sha512-isyNax3wXoKaulPDZWHQqbmIx1k2tb9fb3GGDBRxCscfYV2Ch7WxPArBsFEG8s/safwXTT7H4QGhaIkTp9447w==" }, + "node_modules/unzip-stream": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/unzip-stream/-/unzip-stream-0.3.1.tgz", + "integrity": "sha512-RzaGXLNt+CW+T41h1zl6pGz3EaeVhYlK+rdAap+7DxW5kqsqePO8kRtWPaCiVqdhZc86EctSPVYNix30YOMzmw==", + "dependencies": { + "binary": "^0.3.0", + "mkdirp": "^0.5.1" + } + }, "node_modules/unzipper": { "version": "0.10.14", "resolved": "https://registry.npmjs.org/unzipper/-/unzipper-0.10.14.tgz", diff --git a/packages/artifact/package.json b/packages/artifact/package.json index 894e1607..902f57bd 100644 --- a/packages/artifact/package.json +++ b/packages/artifact/package.json @@ -49,11 +49,13 @@ "@octokit/plugin-retry": "^3.0.9", "@octokit/request-error": "^5.0.0", "@protobuf-ts/plugin": "^2.2.3-alpha.1", + "@types/unzip-stream": "^0.3.4", "@types/unzipper": "^0.10.6", "archiver": "^5.3.1", "crypto": "^1.0.1", "jwt-decode": "^3.1.2", "twirp-ts": "^2.5.0", + "unzip-stream": "^0.3.1", "unzipper": "^0.10.14" }, "devDependencies": { diff --git a/packages/artifact/src/internal/download/download-artifact.ts b/packages/artifact/src/internal/download/download-artifact.ts index 3bb3de61..a61e2937 100644 --- a/packages/artifact/src/internal/download/download-artifact.ts +++ b/packages/artifact/src/internal/download/download-artifact.ts @@ -2,7 +2,7 @@ import fs from 'fs/promises' import * as github from '@actions/github' import * as core from '@actions/core' import * as httpClient from '@actions/http-client' -import unzipper from 'unzipper' +import unzip from 'unzip-stream' import { DownloadArtifactOptions, DownloadArtifactResponse @@ -47,7 +47,12 @@ async function streamExtract(url: string, directory: string): Promise { ) } - return response.message.pipe(unzipper.Extract({path: directory})).promise() + return new Promise((resolve, reject) => { + response.message + .pipe(unzip.Extract({path: directory})) + .on('close', resolve) + .on('error', reject) + }) } export async function downloadArtifactPublic(