ensure we're downloading to the correct directory

Signed-off-by: Eli Uriegas <eliuriegas@fb.com>
This commit is contained in:
Eli Uriegas 2021-05-19 11:44:26 -07:00
parent 34aa167be5
commit c91b9fb13e
2 changed files with 7 additions and 2 deletions

View file

@ -41,12 +41,16 @@ async function run(): Promise<void> {
continue
}
const getObjectParams = {Bucket: s3Bucket, Key: fileObject.Key}
const localKey = fileObject.Key.replace(s3Prefix, '')
const localKey = path.join(
resolvedPath,
fileObject.Key.replace(s3Prefix, '')
)
const writeStream = fs.createWriteStream(localKey)
core.info(`Started download: ${localKey}`)
core.debug(`S3 download uri: s3://${s3Bucket}/${fileObject.Key}`)
const readStream = s3.getObject(getObjectParams).createReadStream()
readStream.pipe(writeStream)
writeStream.close()
core.info(`Finished download for ${localKey}`)
}
})