diff --git a/api.planx.uk/send/exportZip.test.ts b/api.planx.uk/send/exportZip.test.ts index 2ecb05da89..c402ebcc64 100644 --- a/api.planx.uk/send/exportZip.test.ts +++ b/api.planx.uk/send/exportZip.test.ts @@ -7,7 +7,6 @@ jest.mock("fs", () => ({ existsSync: () => true, unlinkSync: () => undefined, createWriteStream: () => undefined, - writeFileSync: () => undefined, rmSync: () => undefined, })); diff --git a/api.planx.uk/send/exportZip.ts b/api.planx.uk/send/exportZip.ts index 80800d84e8..6c3dc6aac1 100644 --- a/api.planx.uk/send/exportZip.ts +++ b/api.planx.uk/send/exportZip.ts @@ -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 {