mirror of https://github.com/actions/toolkit
adding promise to upload
parent
7441cc7b8b
commit
06482c6da1
|
@ -64,33 +64,36 @@ export async function createZipUploadStream(
|
||||||
})
|
})
|
||||||
|
|
||||||
for (const file of uploadSpecification) {
|
for (const file of uploadSpecification) {
|
||||||
if (file.sourcePath !== null) {
|
await new Promise((resolve, reject) => {
|
||||||
// Add a normal file to the zip
|
if (file.sourcePath !== null) {
|
||||||
zip.entry(
|
// Add a normal file to the zip
|
||||||
createReadStream(file.sourcePath),
|
zip.entry(
|
||||||
{name: file.destinationPath},
|
createReadStream(file.sourcePath),
|
||||||
function (err, entry) {
|
{name: file.destinationPath},
|
||||||
|
function (err, entry) {
|
||||||
|
core.debug(`Entry is: ${entry}`)
|
||||||
|
if (err) reject(err)
|
||||||
|
else resolve(entry)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
zip.entry(null, {name: file.destinationPath}, function (err, entry) {
|
||||||
core.debug(`Entry is: ${entry}`)
|
core.debug(`Entry is: ${entry}`)
|
||||||
if (err) throw err
|
if (err) reject(err)
|
||||||
}
|
resolve(entry)
|
||||||
)
|
})
|
||||||
} else {
|
}
|
||||||
zip.entry(null, {name: file.destinationPath}, function (err, entry) {
|
})
|
||||||
core.debug(`Entry is: ${entry}`)
|
|
||||||
if (err) throw err
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const bufferSize = getUploadChunkSize()
|
const bufferSize = getUploadChunkSize()
|
||||||
const zipUploadStream = new ZipUploadStream(bufferSize)
|
const zipUploadStream = new ZipUploadStream(bufferSize)
|
||||||
|
core.debug(
|
||||||
// core.debug(
|
`Zip write high watermark value ${zipUploadStream.writableHighWaterMark}`
|
||||||
// `Zip write high watermark value ${zipUploadStream.writableHighWaterMark}`
|
)
|
||||||
// )
|
core.debug(
|
||||||
// core.debug(
|
`Zip read high watermark value ${zipUploadStream.readableHighWaterMark}`
|
||||||
// `Zip read high watermark value ${zipUploadStream.readableHighWaterMark}`
|
)
|
||||||
// )
|
|
||||||
|
|
||||||
// zip.pipe(zipUploadStream)
|
// zip.pipe(zipUploadStream)
|
||||||
zip.finalize()
|
zip.finalize()
|
||||||
|
|
Loading…
Reference in New Issue