Socket
Socket
Sign inDemoInstall

adm-zip

Package Overview
Dependencies
0
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.5.11 to 0.5.12

59

headers/entryHeader.js

@@ -173,58 +173,37 @@ var Utils = require("../util"),

get realDataOffset() {
return _offset + Constants.LOCHDR + _fnameLen + _extraLen;
return _offset + Constants.LOCHDR + _dataHeader.fnameLen + _dataHeader.extraLen;
},
get dataHeader() {
return _dataHeader;
},
loadDataHeaderFromBinary: function (/*Buffer*/ input) {
var data = input.slice(_offset, _offset + Constants.LOCHDR);
// 30 bytes and should start with "PK\003\004"
if (data.readUInt32LE(0) !== Constants.LOCSIG) {
throw new Error(Utils.Errors.INVALID_LOC);
}
_dataHeader = {
// version needed to extract
version: _version,
version: data.readUInt16LE(Constants.LOCVER),
// general purpose bit flag
flags: _flags,
flags: data.readUInt16LE(Constants.LOCFLG),
// compression method
method: _method,
method: data.readUInt16LE(Constants.LOCHOW),
// modification time (2 bytes time, 2 bytes date)
time: _time,
time: data.readUInt32LE(Constants.LOCTIM),
// uncompressed file crc-32 value
crc: _crc,
crc: data.readUInt32LE(Constants.LOCCRC),
// compressed size
compressedSize: _compressedSize,
compressedSize: data.readUInt32LE(Constants.LOCSIZ),
// uncompressed size
size: _size,
size: data.readUInt32LE(Constants.LOCLEN),
// filename length
fnameLen: _fnameLen,
fnameLen: data.readUInt16LE(Constants.LOCNAM),
// extra field length
extraLen: _extraLen
extraLen: data.readUInt16LE(Constants.LOCEXT)
};
return _dataHeader;
},
loadDataHeaderFromBinary: function (/*Buffer*/ input) {
var data = input.slice(_offset, _offset + Constants.LOCHDR);
// 30 bytes and should start with "PK\003\004"
if (data.readUInt32LE(0) !== Constants.LOCSIG) {
throw new Error(Utils.Errors.INVALID_LOC);
}
// version needed to extract
_version = data.readUInt16LE(Constants.LOCVER);
// general purpose bit flag
_flags = data.readUInt16LE(Constants.LOCFLG);
// compression method
_method = data.readUInt16LE(Constants.LOCHOW);
// modification time (2 bytes time, 2 bytes date)
_time = data.readUInt32LE(Constants.LOCTIM);
// uncompressed file crc-32 value
_crc = data.readUInt32LE(Constants.LOCCRC);
// compressed size
_compressedSize = data.readUInt32LE(Constants.LOCSIZ);
// uncompressed size
_size = data.readUInt32LE(Constants.LOCLEN);
// filename length
_fnameLen = data.readUInt16LE(Constants.LOCNAM);
// extra field length
_extraLen = data.readUInt16LE(Constants.LOCEXT);
},
loadFromBinary: function (/*Buffer*/ data) {

@@ -231,0 +210,0 @@ // data should be 46 bytes and start with "PK 01 02"

{
"name": "adm-zip",
"version": "0.5.11",
"version": "0.5.12",
"description": "Javascript implementation of zip for nodejs with support for electron original-fs. Allows user to create or extract zip files both in memory or to/from disk",

@@ -5,0 +5,0 @@ "scripts": {

@@ -18,4 +18,3 @@ var Utils = require("./util"),

}
//Scanning a local file headers is not necessary (except in the case of corrupted archives)
if(!_entryHeader.compressedSize) _entryHeader.loadDataHeaderFromBinary(input);
_entryHeader.loadDataHeaderFromBinary(input);
return input.slice(_entryHeader.realDataOffset, _entryHeader.realDataOffset + _entryHeader.compressedSize);

@@ -22,0 +21,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc