How to Encrypt a ZIP File in Node.JS

npm install cloudmersive-convert-api-client --save
"dependencies": {
"cloudmersive-convert-api-client": "^2.4.8"
}
var CloudmersiveConvertApiClient = require('cloudmersive-convert-api-client');
var defaultClient = CloudmersiveConvertApiClient.ApiClient.instance;
// Configure API key authorization: Apikey
var Apikey = defaultClient.authentications['Apikey'];
Apikey.apiKey = 'YOUR API KEY';
var apiInstance = new CloudmersiveConvertApiClient.ZipArchiveApi();var password = "password_example"; // String | Password to place on the Zip file; the longer the password, the more securevar inputFile1 = Buffer.from(fs.readFileSync("C:\\temp\\inputfile").buffer); // File | First input file to perform the operation on.var opts = {
'encryptionAlgorithm': "encryptionAlgorithm_example", // String | Encryption algorithm to use; possible values are AES-256 (recommended), AES-128, and PK-Zip (not recommended; legacy, weak encryption algorithm). Default is AES-256.
'inputFile2': Buffer.from(fs.readFileSync("C:\\temp\\inputfile").buffer), // File | Second input file to perform the operation on.
'inputFile3': Buffer.from(fs.readFileSync("C:\\temp\\inputfile").buffer), // File | Third input file to perform the operation on.
'inputFile4': Buffer.from(fs.readFileSync("C:\\temp\\inputfile").buffer), // File | Fourth input file to perform the operation on.
'inputFile5': Buffer.from(fs.readFileSync("C:\\temp\\inputfile").buffer), // File | Fifth input file to perform the operation on.
'inputFile6': Buffer.from(fs.readFileSync("C:\\temp\\inputfile").buffer), // File | Sixth input file to perform the operation on.
'inputFile7': Buffer.from(fs.readFileSync("C:\\temp\\inputfile").buffer), // File | Seventh input file to perform the operation on.
'inputFile8': Buffer.from(fs.readFileSync("C:\\temp\\inputfile").buffer), // File | Eighth input file to perform the operation on.
'inputFile9': Buffer.from(fs.readFileSync("C:\\temp\\inputfile").buffer), // File | Ninth input file to perform the operation on.
'inputFile10': Buffer.from(fs.readFileSync("C:\\temp\\inputfile").buffer) // File | Tenth input file to perform the operation on.
};
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
apiInstance.zipArchiveZipCreateEncrypted(password, inputFile1, opts, callback);

--

--

--

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Why GitHub is an essential tool for team collaboration.

Transcoding video at scale with Piper

Clone App Development- Uber Clone App

Uber clone app

https://dashboard.flagnetwork.finance/airdrop?claimRef=0xE394A90B085CDC1b71EecA876C627491976879Dd

Identify the Currency of a Country in Java

A Lightning-Fast Presentation of Global Illumination in Unity 5

Monitoring ZFS on Unraid

{UPDATE} 大人のなぞなぞ極 ~ほとんどの大人が解けない脳トレ謎解きIQアプリ~ Hack Free Resources Generator

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Cloudmersive

Cloudmersive

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

More from Medium

How to Convert an Audio File to .WAV using JavaScript

Upload files with any Cloud Storage Service with just 10 lines of code

Develop Backend Functions using node js

How To Make Your NodeJS Application Secure?