Skip to content

Commit

Permalink
Revert "chore: Stream S3 files directly to zip (#2380)" (#2469)
Browse files Browse the repository at this point in the history
This reverts commit 96adf16.
  • Loading branch information
jessicamcinchak authored Nov 21, 2023
1 parent a0284fe commit 047c8b7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions api.planx.uk/modules/send/utils/exportZip.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ jest.mock("fs", () => ({
existsSync: () => true,
unlinkSync: () => undefined,
createWriteStream: () => undefined,
writeFileSync: () => undefined,
rmSync: () => undefined,
}));

Expand Down
4 changes: 3 additions & 1 deletion api.planx.uk/modules/send/utils/exportZip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,9 @@ export class ExportZip {
throw new Error("file not found");
}
const filePath = path.join(this.tmpDir, name);
this.zip.addFile(filePath, body as Buffer);
fs.writeFileSync(filePath, body as Buffer);
this.zip.addLocalFile(filePath);
fs.unlinkSync(filePath);
}

toBuffer(): Buffer {
Expand Down

0 comments on commit 047c8b7

Please sign in to comment.