AES-256 and legacy Zip 2.0 encryption for Zip files.
Plugin for archiver that adds encryption capabilities to Zip compression. Pure JS, no external zip software needed.
npm install archiver-zip-encrypted --save
const archiver = require('archiver');
// register format for archiver
// note: only do it once per Node.js process/application, as duplicate registration will throw an error
archiver.registerFormat('zip-encrypted', require("archiver-zip-encrypted"));
// create archive and specify method of encryption and password
let archive = archiver.create('zip-encrypted', {zlib: {level: 8}, encryptionMethod: 'aes256', password: '123'});
archive.append('File contents', {name: 'file.name'})
// ... add contents to archive as usual using archiver
Plugin supports 2 encryption methods:
For more information on these encryption methods and its drawbacks in particular see WinZip documentation. It's worth noting that neither of these encryption methods encrypt file names and their metainformation, such as original size, filesystem dates, permissions etc.