in email-mvt-archive/src/email-mvt-pixel-log-archiver-lambda.ts [42:59]
function processTransfer(
transferableFiles: TransferableFile[],
sourceS3Bucket: string,
destinationS3Bucket: string): Array<Promise<string | S3.Types.CopyObjectOutput>> {
return transferableFiles.map(fileToTransfer => {
return s3.headObject({
Bucket: `${destinationS3Bucket}/dt=${fileToTransfer.destinationFolder}`,
Key: fileToTransfer.sourceFileName
}).promise()
.then(() => Promise.resolve('skipped'))
.catch(() => s3.copyObject({
ACL: 'bucket-owner-read',
Bucket: `${destinationS3Bucket}/dt=${fileToTransfer.destinationFolder}`,
CopySource: `${sourceS3Bucket}/${fileToTransfer.sourceFileName}`,
Key: fileToTransfer.sourceFileName
}).promise());
});
}