How to Create a ZIP file in Node JS - Tutorial

How to Create a ZIP file in Node JS


In this article, we are going to teach you how you can create a ZIP file of any file or folder with all its sub-folders in Node JS.

Video Tutorial:

First, you need to install a module named “zip-local” in your project. So run the following command in your command prompt or terminal:

npm install zip-local

Then you need to include the module in your server file where you want to use it.

const zipLocal = require("zip-local");

After that, whenever you want to want to execute the code to create a folder ZIP, paste the following lines:"files").compress().save("");

zip(): Accepts the path and name of the file or folder that needs to be zipped.

save(): Accepts the path and name of a new ZIP file.

So that’s how you can create a zip file in your Node JS project.
Learn how to password protect a zip file from this tutorial.

How useful was this post

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

As you found this post useful...

Follow us on social media!

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post

Leave a Reply

Please disable your adblocker or whitelist this site!