@@ -277,7 +277,7 @@ function getEndOfCentralDirectoryRecord(self, actuallyJustTellMeHowLongItWouldBe
277
277
}
278
278
}
279
279
280
- var eocdrBuffer = new Buffer ( END_OF_CENTRAL_DIRECTORY_RECORD_SIZE ) ;
280
+ var eocdrBuffer = Buffer . alloc ( END_OF_CENTRAL_DIRECTORY_RECORD_SIZE ) ;
281
281
// end of central dir signature 4 bytes (0x06054b50)
282
282
eocdrBuffer . writeUInt32LE ( 0x06054b50 , 0 ) ;
283
283
// number of this disk 2 bytes
@@ -301,7 +301,7 @@ function getEndOfCentralDirectoryRecord(self, actuallyJustTellMeHowLongItWouldBe
301
301
302
302
// ZIP64 format
303
303
// ZIP64 End of Central Directory Record
304
- var zip64EocdrBuffer = new Buffer ( ZIP64_END_OF_CENTRAL_DIRECTORY_RECORD_SIZE ) ;
304
+ var zip64EocdrBuffer = Buffer . alloc ( ZIP64_END_OF_CENTRAL_DIRECTORY_RECORD_SIZE ) ;
305
305
// zip64 end of central dir signature 4 bytes (0x06064b50)
306
306
zip64EocdrBuffer . writeUInt32LE ( 0x06064b50 , 0 ) ;
307
307
// size of zip64 end of central directory record 8 bytes
@@ -327,7 +327,7 @@ function getEndOfCentralDirectoryRecord(self, actuallyJustTellMeHowLongItWouldBe
327
327
328
328
329
329
// ZIP64 End of Central Directory Locator
330
- var zip64EocdlBuffer = new Buffer ( ZIP64_END_OF_CENTRAL_DIRECTORY_LOCATOR_SIZE ) ;
330
+ var zip64EocdlBuffer = Buffer . alloc ( ZIP64_END_OF_CENTRAL_DIRECTORY_LOCATOR_SIZE ) ;
331
331
// zip64 end of central dir locator signature 4 bytes (0x07064b50)
332
332
zip64EocdlBuffer . writeUInt32LE ( 0x07064b50 , 0 ) ;
333
333
// number of the disk with the start of the zip64 end of central directory 4 bytes
@@ -365,7 +365,7 @@ var defaultDirectoryMode = parseInt("040775", 8);
365
365
366
366
// this class is not part of the public API
367
367
function Entry ( metadataPath , isDirectory , options ) {
368
- this . utf8FileName = new Buffer ( metadataPath ) ;
368
+ this . utf8FileName = Buffer . from ( metadataPath ) ;
369
369
if ( this . utf8FileName . length > 0xffff ) throw new Error ( "utf8 file name too long. " + utf8FileName . length + " > " + 0xffff ) ;
370
370
this . isDirectory = isDirectory ;
371
371
this . state = Entry . WAITING_FOR_METADATA ;
@@ -440,7 +440,7 @@ Entry.prototype.getLocalFileHeader = function() {
440
440
uncompressedSize = this . uncompressedSize ;
441
441
}
442
442
443
- var fixedSizeStuff = new Buffer ( LOCAL_FILE_HEADER_FIXED_SIZE ) ;
443
+ var fixedSizeStuff = Buffer . alloc ( LOCAL_FILE_HEADER_FIXED_SIZE ) ;
444
444
var generalPurposeBitFlag = FILE_NAME_IS_UTF8 ;
445
445
if ( ! this . crcAndFileSizeKnown ) generalPurposeBitFlag |= UNKNOWN_CRC32_AND_FILE_SIZES ;
446
446
@@ -479,10 +479,10 @@ var ZIP64_DATA_DESCRIPTOR_SIZE = 24;
479
479
Entry . prototype . getDataDescriptor = function ( ) {
480
480
if ( this . crcAndFileSizeKnown ) {
481
481
// the Mac Archive Utility requires this not be present unless we set general purpose bit 3
482
- return new Buffer ( 0 ) ;
482
+ return Buffer . alloc ( 0 ) ;
483
483
}
484
484
if ( ! this . useZip64Format ( ) ) {
485
- var buffer = new Buffer ( DATA_DESCRIPTOR_SIZE ) ;
485
+ var buffer = Buffer . alloc ( DATA_DESCRIPTOR_SIZE ) ;
486
486
// optional signature (required according to Archive Utility)
487
487
buffer . writeUInt32LE ( 0x08074b50 , 0 ) ;
488
488
// crc-32 4 bytes
@@ -494,7 +494,7 @@ Entry.prototype.getDataDescriptor = function() {
494
494
return buffer ;
495
495
} else {
496
496
// ZIP64 format
497
- var buffer = new Buffer ( ZIP64_DATA_DESCRIPTOR_SIZE ) ;
497
+ var buffer = Buffer . alloc ( ZIP64_DATA_DESCRIPTOR_SIZE ) ;
498
498
// optional signature (unknown if anyone cares about this)
499
499
buffer . writeUInt32LE ( 0x08074b50 , 0 ) ;
500
500
// crc-32 4 bytes
@@ -509,7 +509,7 @@ Entry.prototype.getDataDescriptor = function() {
509
509
var CENTRAL_DIRECTORY_RECORD_FIXED_SIZE = 46 ;
510
510
var ZIP64_EXTENDED_INFORMATION_EXTRA_FIELD_SIZE = 28 ;
511
511
Entry . prototype . getCentralDirectoryRecord = function ( ) {
512
- var fixedSizeStuff = new Buffer ( CENTRAL_DIRECTORY_RECORD_FIXED_SIZE ) ;
512
+ var fixedSizeStuff = Buffer . alloc ( CENTRAL_DIRECTORY_RECORD_FIXED_SIZE ) ;
513
513
var generalPurposeBitFlag = FILE_NAME_IS_UTF8 ;
514
514
if ( ! this . crcAndFileSizeKnown ) generalPurposeBitFlag |= UNKNOWN_CRC32_AND_FILE_SIZES ;
515
515
@@ -525,7 +525,7 @@ Entry.prototype.getCentralDirectoryRecord = function() {
525
525
versionNeededToExtract = VERSION_NEEDED_TO_EXTRACT_ZIP64 ;
526
526
527
527
// ZIP64 extended information extra field
528
- zeiefBuffer = new Buffer ( ZIP64_EXTENDED_INFORMATION_EXTRA_FIELD_SIZE ) ;
528
+ zeiefBuffer = Buffer . alloc ( ZIP64_EXTENDED_INFORMATION_EXTRA_FIELD_SIZE ) ;
529
529
// 0x0001 2 bytes Tag for this "extra" block type
530
530
zeiefBuffer . writeUInt16LE ( 0x0001 , 0 ) ;
531
531
// Size 2 bytes Size of this "extra" block
@@ -540,7 +540,7 @@ Entry.prototype.getCentralDirectoryRecord = function() {
540
540
// (omit)
541
541
} else {
542
542
versionNeededToExtract = VERSION_NEEDED_TO_EXTRACT_UTF8 ;
543
- zeiefBuffer = new Buffer ( 0 ) ;
543
+ zeiefBuffer = Buffer . alloc ( 0 ) ;
544
544
}
545
545
546
546
// central file header signature 4 bytes (0x02014b50)
0 commit comments