How to Decrypt a ZIP File in Node.JS

Cloudmersive
Nov 5, 2020

Receiving ZIP files can seem daunting, particularly when faced with the need for decryption. In order to revert ZIP files into a more accessible format that can be easily viewed and utilized, the following API will automatically decrypt and remove password protection. The necessary parameters for running this function include the input file as well as the password for the input archive.

To use the API, you can run this command to install the SDK:

npm install cloudmersive-convert-api-client --save

Or, you can add this snippet to your package.json:

"dependencies": {
"cloudmersive-convert-api-client": "^2.4.8"
}

Then, you can call the function:

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 inputFile = Buffer.from(fs.readFileSync("C:\\temp\\inputfile").buffer); // File | Input file to perform the operation on.var zipPassword = "zipPassword_example"; // String | Required; Password for the input archivevar callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
apiInstance.zipArchiveZipDecrypt(inputFile, zipPassword, callback);

You can retrieve the API Key for this function at no cost and with no commitment on the Cloudmersive website. This will give you access to 800 monthly calls across our entire API library.

--

--

Cloudmersive

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