@@ -170,60 +170,39 @@ module.exports = function () {
170
170
} ,
171
171
172
172
get realDataOffset ( ) {
173
- return _offset + Constants . LOCHDR + _fnameLen + _extraLen ;
173
+ return _offset + Constants . LOCHDR + _dataHeader . fnameLen + _dataHeader . extraLen ;
174
174
} ,
175
175
176
176
get dataHeader ( ) {
177
+ return _dataHeader ;
178
+ } ,
179
+
180
+ loadDataHeaderFromBinary : function ( /*Buffer*/ input ) {
181
+ var data = input . slice ( _offset , _offset + Constants . LOCHDR ) ;
182
+ // 30 bytes and should start with "PK\003\004"
183
+ if ( data . readUInt32LE ( 0 ) !== Constants . LOCSIG ) {
184
+ throw new Error ( Utils . Errors . INVALID_LOC ) ;
185
+ }
177
186
_dataHeader = {
178
187
// version needed to extract
179
- version : _version ,
188
+ version : data . readUInt16LE ( Constants . LOCVER ) ,
180
189
// general purpose bit flag
181
- flags : _flags ,
190
+ flags : data . readUInt16LE ( Constants . LOCFLG ) ,
182
191
// compression method
183
- method : _method ,
192
+ method : data . readUInt16LE ( Constants . LOCHOW ) ,
184
193
// modification time (2 bytes time, 2 bytes date)
185
- time : _time ,
194
+ time : data . readUInt32LE ( Constants . LOCTIM ) ,
186
195
// uncompressed file crc-32 value
187
- crc : _crc ,
196
+ crc : data . readUInt32LE ( Constants . LOCCRC ) ,
188
197
// compressed size
189
- compressedSize : _compressedSize ,
198
+ compressedSize : data . readUInt32LE ( Constants . LOCSIZ ) ,
190
199
// uncompressed size
191
- size : _size ,
200
+ size : data . readUInt32LE ( Constants . LOCLEN ) ,
192
201
// filename length
193
- fnameLen : _fnameLen ,
202
+ fnameLen : data . readUInt16LE ( Constants . LOCNAM ) ,
194
203
// extra field length
195
- extraLen : _extraLen
204
+ extraLen : data . readUInt16LE ( Constants . LOCEXT )
196
205
} ;
197
-
198
- return _dataHeader ;
199
- } ,
200
-
201
- loadDataHeaderFromBinary : function ( /*Buffer*/ input ) {
202
- var data = input . slice ( _offset , _offset + Constants . LOCHDR ) ;
203
- // 30 bytes and should start with "PK\003\004"
204
- if ( data . readUInt32LE ( 0 ) !== Constants . LOCSIG ) {
205
- throw new Error ( Utils . Errors . INVALID_LOC ) ;
206
- }
207
-
208
- // version needed to extract
209
- _version = data . readUInt16LE ( Constants . LOCVER ) ;
210
- // general purpose bit flag
211
- _flags = data . readUInt16LE ( Constants . LOCFLG ) ;
212
- // compression method
213
- _method = data . readUInt16LE ( Constants . LOCHOW ) ;
214
- // modification time (2 bytes time, 2 bytes date)
215
- _time = data . readUInt32LE ( Constants . LOCTIM ) ;
216
- // uncompressed file crc-32 value
217
- _crc = data . readUInt32LE ( Constants . LOCCRC ) ;
218
- // compressed size
219
- _compressedSize = data . readUInt32LE ( Constants . LOCSIZ ) ;
220
- // uncompressed size
221
- _size = data . readUInt32LE ( Constants . LOCLEN ) ;
222
- // filename length
223
- _fnameLen = data . readUInt16LE ( Constants . LOCNAM ) ;
224
- // extra field length
225
- _extraLen = data . readUInt16LE ( Constants . LOCEXT ) ;
226
-
227
206
} ,
228
207
229
208
loadFromBinary : function ( /*Buffer*/ data ) {
0 commit comments