Dive into secure and efficient coding practices with our curated list of the top 10 examples showcasing 'zip-stream' in functional components in JavaScript. Our advanced machine learning engine meticulously scans each line of code, cross-referencing millions of open source libraries to ensure your implementation is not just functional, but also robust and secure. Elevate your React applications to new heights by mastering the art of handling side effects, API calls, and asynchronous operations with confidence and precision.
ZipAesStream.prototype._writeLocalFileHeader = function (ae) {
let gpb = ae.getGeneralPurposeBit();
// set AES-specific fields
gpb.useEncryption(true);
ae.setExtra(_buildAesExtraField(ae));
ae.setMethod(ZIP_AES_METHOD);
ae.setVersionNeededToExtract(51);
ZipStream.prototype._writeLocalFileHeader.call(this, ae);
};
ZipCryptoStream.prototype._writeLocalFileHeader = function (ae) {
// set encryption
ae.getGeneralPurposeBit().useEncryption(true);
ZipStream.prototype._writeLocalFileHeader.call(this, ae);
};
ZipCryptoStream.prototype.entry = function(source, data, callback) {
return ZipStream.prototype.entry.call(this, source, data, callback);
};
ZipCryptoStream.prototype._appendStream = function(ae, source, callback) {
ae.gpb.useEncryption(true);
ZipStream.prototype._appendStream.call(this, ae, source, callback);
};
ZipCryptoStream.prototype._normalizeFileData = function(data) {
return ZipStream.prototype._normalizeFileData.call(this, data);
};
const ZipCryptoStream = function (options = {zlib: {}}) {
if (!(this instanceof ZipCryptoStream)) {
return new ZipCryptoStream(options);
}
this.key = options.password;
if (!Buffer.isBuffer(this.key)) {
this.key = Buffer.from(options.password);
}
ZipStream.call(this, options);
};
inherits(ZipCryptoStream, ZipStream);
const ZipAesStream = function (options = {zlib: {}}) {
if (!(this instanceof ZipAesStream)) {
return new ZipAesStream(options);
}
this.key = options.password;
if (!Buffer.isBuffer(this.key)) {
this.key = Buffer.from(this.key);
}
ZipStream.call(this, options);
};
inherits(ZipAesStream, ZipStream);