mirror of
https://git.mirrors.martin98.com/https://github.com/actions/toolkit
synced 2026-04-01 03:13:15 +08:00
Adding buffer and zlib options
This commit is contained in:
@@ -109,10 +109,10 @@ export async function uploadArtifact(
|
||||
`Artifact ${name}.zip successfully finalized. Artifact ID ${artifactId}`
|
||||
)
|
||||
// if (core.isDebug()) {
|
||||
setTimeout(function () {
|
||||
core.debug('Processes keeping upload stream running:')
|
||||
whyIsNodeRunning()
|
||||
}, 500)
|
||||
setTimeout(function () {
|
||||
core.debug('Processes keeping upload stream running:')
|
||||
whyIsNodeRunning()
|
||||
}, 500)
|
||||
// }
|
||||
//
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import * as stream from 'stream'
|
||||
import * as archiver from 'archiver'
|
||||
import * as packer from 'zip-stream'
|
||||
|
||||
import * as core from '@actions/core'
|
||||
import {createReadStream} from 'fs'
|
||||
import {UploadZipSpecification} from './upload-zip-specification'
|
||||
@@ -29,12 +31,22 @@ export async function createZipUploadStream(
|
||||
core.debug(
|
||||
`Creating Artifact archive with compressionLevel: ${compressionLevel}`
|
||||
)
|
||||
|
||||
const zip = archiver.create('zip', {
|
||||
highWaterMark: getUploadChunkSize(),
|
||||
zlib: {level: compressionLevel}
|
||||
})
|
||||
// const zip2 = archiver.create('zip', {
|
||||
// highWaterMark: getUploadChunkSize(),
|
||||
// zlib: {level: compressionLevel}
|
||||
// })
|
||||
|
||||
const zlibOptions = {
|
||||
zlib: {level: compressionLevel, bufferSize: getUploadChunkSize()}
|
||||
}
|
||||
const zip = new packer(zlibOptions)
|
||||
// zip.entry('string contents', {name: 'string.txt'}, function (err, entry) {
|
||||
// if (err) throw err
|
||||
// zip.entry(null, {name: 'directory/'}, function (err, entry) {
|
||||
// if (err) throw err
|
||||
// zip.finish()
|
||||
// })
|
||||
// })
|
||||
// register callbacks for various events during the zip lifecycle
|
||||
zip.on('error', zipErrorCallback)
|
||||
zip.on('warning', zipWarningCallback)
|
||||
|
||||
Reference in New Issue
Block a user