From da5e926162e14c8139a382d7122207982f9c9ac2 Mon Sep 17 00:00:00 2001 From: Vallie Joseph Date: Mon, 8 Apr 2024 17:39:15 +0000 Subject: [PATCH] removing promise wrap --- packages/artifact/src/internal/upload/zip.ts | 36 +++++++++----------- packages/attest/package-lock.json | 2 +- 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/packages/artifact/src/internal/upload/zip.ts b/packages/artifact/src/internal/upload/zip.ts index bdae11b6..9008d5d9 100644 --- a/packages/artifact/src/internal/upload/zip.ts +++ b/packages/artifact/src/internal/upload/zip.ts @@ -43,11 +43,10 @@ export async function createZipUploadStream( const zipUploadStream = new ZipUploadStream(bufferSize) zip.pipe(zipUploadStream) // register callbacks for various events during the zip lifecycle - zip.on('warning', zipWarningCallback) zip.on('error', zipErrorCallback) + zip.on('warning', zipWarningCallback) zip.on('finish', zipFinishCallback) zip.on('end', zipEndCallback) - const addFileToZip = ( file: UploadZipSpecification, callback: (error?: Error) => void @@ -75,24 +74,23 @@ export async function createZipUploadStream( } } - return new Promise((resolve, reject) => { - async.eachSeries(uploadSpecification, addFileToZip, (error: unknown) => { - if (error) { - core.error('Failed to add a file to the zip:') - core.info(error.toString()) // Convert error to string - reject(error) - return - } - zip.finalize() // Finalize the archive once all files have been added - core.debug( - `Zip write high watermark value ${zipUploadStream.writableHighWaterMark}` - ) - core.debug( - `Zip read high watermark value ${zipUploadStream.readableHighWaterMark}` - ) - resolve(zipUploadStream) - }) + async.eachSeries(uploadSpecification, addFileToZip, (error: unknown) => { + if (error) { + core.error('Failed to add a file to the zip:') + core.info(error.toString()) // Convert error to string + return + } + zip.finalize() // Finalize the archive once all files have been added }) + + core.debug( + `Zip write high watermark value ${zipUploadStream.writableHighWaterMark}` + ) + core.debug( + `Zip read high watermark value ${zipUploadStream.readableHighWaterMark}` + ) + + return zipUploadStream } // eslint-disable-next-line @typescript-eslint/no-explicit-any diff --git a/packages/attest/package-lock.json b/packages/attest/package-lock.json index 362633fb..569cc7ed 100644 --- a/packages/attest/package-lock.json +++ b/packages/attest/package-lock.json @@ -3561,4 +3561,4 @@ "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" } } -} \ No newline at end of file +}