This commit is contained in:
Tom Moor
2023-01-29 06:28:57 -08:00
committed by GitHub
parent f0d9bb4898
commit 85ca25371c
9 changed files with 46 additions and 29 deletions

View File

@@ -185,15 +185,14 @@ export const getAWSKeyForFileOp = (teamId: string, name: string) => {
return `${bucket}/${teamId}/${uuidv4()}/${name}-export.zip`;
};
export const getFileByKey = async (key: string) => {
export const getFileByKey = (key: string) => {
const params = {
Bucket: AWS_S3_UPLOAD_BUCKET_NAME,
Key: key,
};
try {
const data = await s3.getObject(params).promise();
return data.Body || null;
return s3.getObject(params).createReadStream();
} catch (err) {
Logger.error("Error getting file from S3 by key", err, {
key,