Skip to content

PDF file corrupted when zipped and downloaded #29

@josephchan91

Description

@josephchan91

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions