Search code examples
javascriptnode.jsjszip

Editing a file within a zipped file using JSZip


Using JSZip, is there a way to edit a file within a zipped file?

I've tried looking for solutions and going through the API but I can't seem to find a solution.

Any help with this would be great! Thanks in advance!


Solution

  • You can edit a file inside your zip with .file method.

    zip.file("existing_filename", "new file content");
    

    This method is used for adding and updating file content.

    Just make sure the file already exist.

    You can read more about it in the documentation.