fix: Refactor attachment downloads during export to use promises (#5294
* Refactor attachment downloads during export to use promises instead of streams Date attachments in zip file correctly * tsc
This commit is contained in:
@@ -13,8 +13,9 @@ import {
|
||||
import {
|
||||
publicS3Endpoint,
|
||||
deleteFromS3,
|
||||
getFileByKey,
|
||||
getFileStream,
|
||||
getSignedUrl,
|
||||
getFileBuffer,
|
||||
} from "@server/utils/s3";
|
||||
import Document from "./Document";
|
||||
import Team from "./Team";
|
||||
@@ -75,7 +76,14 @@ class Attachment extends IdModel {
|
||||
* Get the contents of this attachment as a readable stream.
|
||||
*/
|
||||
get stream() {
|
||||
return getFileByKey(this.key);
|
||||
return getFileStream(this.key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the contents of this attachment as a buffer.
|
||||
*/
|
||||
get buffer() {
|
||||
return getFileBuffer(this.key);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
FileOperationState,
|
||||
FileOperationType,
|
||||
} from "@shared/types";
|
||||
import { deleteFromS3, getFileByKey } from "@server/utils/s3";
|
||||
import { deleteFromS3, getFileStream } from "@server/utils/s3";
|
||||
import Collection from "./Collection";
|
||||
import Team from "./Team";
|
||||
import User from "./User";
|
||||
@@ -77,7 +77,7 @@ class FileOperation extends IdModel {
|
||||
* The file operation contents as a readable stream.
|
||||
*/
|
||||
get stream() {
|
||||
return getFileByKey(this.key);
|
||||
return getFileStream(this.key);
|
||||
}
|
||||
|
||||
// hooks
|
||||
|
||||
Reference in New Issue
Block a user