Skip to content

Commit

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

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

toBuffer(): Buffer {
Expand Down

0 comments on commit 96adf16

Please sign in to comment.