I'm using PDFKit to generate a PDF file. I want to zip it into a folder together with an excel file. When I download the zip file, I'm getting a 0kb pdf file. The excel file works fine though.
const zip = new require("node-zip")();
zip.file(pdfFilePath, fs.readFileSync(`tmp/${pdfFilePath}`));
const zipData = zip.generate({ base64: false, compression: "DEFLATE" });
const zipFilePath = `tmp/myzipfile.zip`;
fs.writeFileSync(zipFilePath, zipData, "binary");
Any suggestions?