Password protect ZIP file in Mac OS X

In this article, we will show you how you can password protect your zip file in Mac OS X. To create a ZIP file and set the password to it using Mac, you simply need to follow the following steps:

  1. Open Terminal
  2. Open folder where target file is located by running the command:
    • cd “path of folder”
  3. Run the following command:
    • zip -er “my-file.zip” “target file or folder”
  4. It will ask password twice.

It may take longer for large files. You can then use the encrypted file on all iOS-based devices like Mac, iPhone, iPad, etc.

Learn how to password protect a ZIP file in PHP from this tutorial.

If you are a windows user, you can use the 7-zip software to password-protect the files.

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:

zipLocal.sync.zip("files").compress().save("my-files.zip")

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.