artem-karpenko / archiver-zip-encrypted

Plugin for archiver to create ZIP archives with password using either AES or legacy Zip 2.0 encryption
MIT License
60 stars 5 forks source link
aes-256 archiver encryption password zip

archiver-zip-encrypted

AES-256 and legacy Zip 2.0 encryption for Zip files.

Build Status Coverage Status

Plugin for archiver that adds encryption capabilities to Zip compression. Pure JS, no external zip software needed.

Install

npm install archiver-zip-encrypted --save

Usage

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

Encryption methods

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.