constants.js 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. module.exports = {
  2. /* The local file header */
  3. LOCHDR : 30, // LOC header size
  4. LOCSIG : 0x04034b50, // "PK\003\004"
  5. LOCVER : 4, // version needed to extract
  6. LOCFLG : 6, // general purpose bit flag
  7. LOCHOW : 8, // compression method
  8. LOCTIM : 10, // modification time (2 bytes time, 2 bytes date)
  9. LOCCRC : 14, // uncompressed file crc-32 value
  10. LOCSIZ : 18, // compressed size
  11. LOCLEN : 22, // uncompressed size
  12. LOCNAM : 26, // filename length
  13. LOCEXT : 28, // extra field length
  14. /* The Data descriptor */
  15. EXTSIG : 0x08074b50, // "PK\007\008"
  16. EXTHDR : 16, // EXT header size
  17. EXTCRC : 4, // uncompressed file crc-32 value
  18. EXTSIZ : 8, // compressed size
  19. EXTLEN : 12, // uncompressed size
  20. /* The central directory file header */
  21. CENHDR : 46, // CEN header size
  22. CENSIG : 0x02014b50, // "PK\001\002"
  23. CENVEM : 4, // version made by
  24. CENVER : 6, // version needed to extract
  25. CENFLG : 8, // encrypt, decrypt flags
  26. CENHOW : 10, // compression method
  27. CENTIM : 12, // modification time (2 bytes time, 2 bytes date)
  28. CENCRC : 16, // uncompressed file crc-32 value
  29. CENSIZ : 20, // compressed size
  30. CENLEN : 24, // uncompressed size
  31. CENNAM : 28, // filename length
  32. CENEXT : 30, // extra field length
  33. CENCOM : 32, // file comment length
  34. CENDSK : 34, // volume number start
  35. CENATT : 36, // internal file attributes
  36. CENATX : 38, // external file attributes (host system dependent)
  37. CENOFF : 42, // LOC header offset
  38. /* The entries in the end of central directory */
  39. ENDHDR : 22, // END header size
  40. ENDSIG : 0x06054b50, // "PK\005\006"
  41. ENDSUB : 8, // number of entries on this disk
  42. ENDTOT : 10, // total number of entries
  43. ENDSIZ : 12, // central directory size in bytes
  44. ENDOFF : 16, // offset of first CEN header
  45. ENDCOM : 20, // zip file comment length
  46. END64HDR : 20, // zip64 END header size
  47. END64SIG : 0x07064b50, // zip64 Locator signature, "PK\006\007"
  48. END64START : 4, // number of the disk with the start of the zip64
  49. END64OFF : 8, // relative offset of the zip64 end of central directory
  50. END64NUMDISKS : 16, // total number of disks
  51. ZIP64SIG : 0x06064b50, // zip64 signature, "PK\006\006"
  52. ZIP64HDR : 56, // zip64 record minimum size
  53. ZIP64LEAD : 12, // leading bytes at the start of the record, not counted by the value stored in ZIP64SIZE
  54. ZIP64SIZE : 4, // zip64 size of the central directory record
  55. ZIP64VEM : 12, // zip64 version made by
  56. ZIP64VER : 14, // zip64 version needed to extract
  57. ZIP64DSK : 16, // zip64 number of this disk
  58. ZIP64DSKDIR : 20, // number of the disk with the start of the record directory
  59. ZIP64SUB : 24, // number of entries on this disk
  60. ZIP64TOT : 32, // total number of entries
  61. ZIP64SIZB : 40, // zip64 central directory size in bytes
  62. ZIP64OFF : 48, // offset of start of central directory with respect to the starting disk number
  63. ZIP64EXTRA : 56, // extensible data sector
  64. /* Compression methods */
  65. STORED : 0, // no compression
  66. SHRUNK : 1, // shrunk
  67. REDUCED1 : 2, // reduced with compression factor 1
  68. REDUCED2 : 3, // reduced with compression factor 2
  69. REDUCED3 : 4, // reduced with compression factor 3
  70. REDUCED4 : 5, // reduced with compression factor 4
  71. IMPLODED : 6, // imploded
  72. // 7 reserved for Tokenizing compression algorithm
  73. DEFLATED : 8, // deflated
  74. ENHANCED_DEFLATED: 9, // enhanced deflated
  75. PKWARE : 10,// PKWare DCL imploded
  76. // 11 reserved by PKWARE
  77. BZIP2 : 12, // compressed using BZIP2
  78. // 13 reserved by PKWARE
  79. LZMA : 14, // LZMA
  80. // 15-17 reserved by PKWARE
  81. IBM_TERSE : 18, // compressed using IBM TERSE
  82. IBM_LZ77 : 19, // IBM LZ77 z
  83. AES_ENCRYPT : 99, // WinZIP AES encryption method
  84. /* General purpose bit flag */
  85. // values can obtained with expression 2**bitnr
  86. FLG_ENC : 1, // Bit 0: encrypted file
  87. FLG_COMP1 : 2, // Bit 1, compression option
  88. FLG_COMP2 : 4, // Bit 2, compression option
  89. FLG_DESC : 8, // Bit 3, data descriptor
  90. FLG_ENH : 16, // Bit 4, enhanced deflating
  91. FLG_PATCH : 32, // Bit 5, indicates that the file is compressed patched data.
  92. FLG_STR : 64, // Bit 6, strong encryption (patented)
  93. // Bits 7-10: Currently unused.
  94. FLG_EFS : 2048, // Bit 11: Language encoding flag (EFS)
  95. // Bit 12: Reserved by PKWARE for enhanced compression.
  96. // Bit 13: encrypted the Central Directory (patented).
  97. // Bits 14-15: Reserved by PKWARE.
  98. FLG_MSK : 4096, // mask header values
  99. /* Load type */
  100. FILE : 2,
  101. BUFFER : 1,
  102. NONE : 0,
  103. /* 4.5 Extensible data fields */
  104. EF_ID : 0,
  105. EF_SIZE : 2,
  106. /* Header IDs */
  107. ID_ZIP64 : 0x0001,
  108. ID_AVINFO : 0x0007,
  109. ID_PFS : 0x0008,
  110. ID_OS2 : 0x0009,
  111. ID_NTFS : 0x000a,
  112. ID_OPENVMS : 0x000c,
  113. ID_UNIX : 0x000d,
  114. ID_FORK : 0x000e,
  115. ID_PATCH : 0x000f,
  116. ID_X509_PKCS7 : 0x0014,
  117. ID_X509_CERTID_F : 0x0015,
  118. ID_X509_CERTID_C : 0x0016,
  119. ID_STRONGENC : 0x0017,
  120. ID_RECORD_MGT : 0x0018,
  121. ID_X509_PKCS7_RL : 0x0019,
  122. ID_IBM1 : 0x0065,
  123. ID_IBM2 : 0x0066,
  124. ID_POSZIP : 0x4690,
  125. EF_ZIP64_OR_32 : 0xffffffff,
  126. EF_ZIP64_OR_16 : 0xffff,
  127. EF_ZIP64_SUNCOMP : 0,
  128. EF_ZIP64_SCOMP : 8,
  129. EF_ZIP64_RHO : 16,
  130. EF_ZIP64_DSN : 24
  131. };