Use streams to download attachments directly to disk

Co-authored-by: trevor-signal <131492920+trevor-signal@users.noreply.github.com>
This commit is contained in:
Scott Nonnenberg
2023-10-30 09:24:28 -07:00
committed by GitHub
parent 2da49456c6
commit 99b2bc304e
48 changed files with 2297 additions and 356 deletions

View File

@@ -593,10 +593,18 @@ export const processNewAttachment = async (
isIncoming: true,
}
);
const onDiskAttachment = await migrateDataToFileSystem(rotatedAttachment, {
writeNewAttachmentData,
logger,
});
let onDiskAttachment = rotatedAttachment;
// If we rotated the attachment, then `data` will be the actual bytes of the attachment,
// in memory. We want that updated attachment to go back to disk.
if (rotatedAttachment.data) {
onDiskAttachment = await migrateDataToFileSystem(rotatedAttachment, {
writeNewAttachmentData,
logger,
});
}
const finalAttachment = await captureDimensionsAndScreenshot(
onDiskAttachment,
{