How to use the archiver/lib/plugins/zip.call function in archiver

To help you get started, we’ve selected a few archiver examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github artem-karpenko / archiver-zip-encrypted / lib / zip-crypto / zip-crypto.js View on Github external
const ZipCrypto = function (options = {}) {
    if (!options.password) {
        throw new Error('options.password is required');
    }
    if (!Buffer.isBuffer(options.password)) {
        options.password = Buffer.from(options.password, 'utf-8');
    }

    if (!(this instanceof ZipCrypto)) {
        return new ZipCrypto(options);
    }

    Zip.call(this, options);

    this.engine = new ZipCryptoStream(this.options);
};
inherits(ZipCrypto, Zip);
github artem-karpenko / archiver-zip-encrypted / lib / zip-encrypted.js View on Github external
const ZipEncrypted = function (options = {}) {
    if (!options.password) {
        throw new Error('options.password is required');
    }
    if (!Buffer.isBuffer(options.password)) {
        options.password = Buffer.from(options.password, 'utf-8');
    }

    if (!(this instanceof ZipEncrypted)) {
        return new ZipEncrypted(options);
    }

    Zip.call(this, options);

    switch (options.encryptionMethod) {
    case 'aes256': this.engine = new ZipAesStream(options); break;
    case 'zip20': this.engine = new ZipCryptoStream(options); break;
    default: throw new Error(`Unsupported encryption method: '${options.encryptionMethod}'. Please use either 'aes256' or 'zip20'.`);
    }
};
inherits(ZipEncrypted, Zip);

archiver

a streaming interface for archive generation

MIT
Latest version published 2 months ago

Package Health Score

88 / 100
Full package analysis