constants.js 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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. /* Compression methods */
  47. STORED : 0, // no compression
  48. SHRUNK : 1, // shrunk
  49. REDUCED1 : 2, // reduced with compression factor 1
  50. REDUCED2 : 3, // reduced with compression factor 2
  51. REDUCED3 : 4, // reduced with compression factor 3
  52. REDUCED4 : 5, // reduced with compression factor 4
  53. IMPLODED : 6, // imploded
  54. // 7 reserved
  55. DEFLATED : 8, // deflated
  56. ENHANCED_DEFLATED: 9, // enhanced deflated
  57. PKWARE : 10,// PKWare DCL imploded
  58. // 11 reserved
  59. BZIP2 : 12, // compressed using BZIP2
  60. // 13 reserved
  61. LZMA : 14, // LZMA
  62. // 15-17 reserved
  63. IBM_TERSE : 18, // compressed using IBM TERSE
  64. IBM_LZ77 : 19, //IBM LZ77 z
  65. /* General purpose bit flag */
  66. FLG_ENC : 0, // encripted file
  67. FLG_COMP1 : 1, // compression option
  68. FLG_COMP2 : 2, // compression option
  69. FLG_DESC : 4, // data descriptor
  70. FLG_ENH : 8, // enhanced deflation
  71. FLG_STR : 16, // strong encryption
  72. FLG_LNG : 1024, // language encoding
  73. FLG_MSK : 4096, // mask header values
  74. /* Load type */
  75. FILE : 0,
  76. BUFFER : 1,
  77. NONE : 2,
  78. /* 4.5 Extensible data fields */
  79. EF_ID : 0,
  80. EF_SIZE : 2,
  81. /* Header IDs */
  82. ID_ZIP64 : 0x0001,
  83. ID_AVINFO : 0x0007,
  84. ID_PFS : 0x0008,
  85. ID_OS2 : 0x0009,
  86. ID_NTFS : 0x000a,
  87. ID_OPENVMS : 0x000c,
  88. ID_UNIX : 0x000d,
  89. ID_FORK : 0x000e,
  90. ID_PATCH : 0x000f,
  91. ID_X509_PKCS7 : 0x0014,
  92. ID_X509_CERTID_F : 0x0015,
  93. ID_X509_CERTID_C : 0x0016,
  94. ID_STRONGENC : 0x0017,
  95. ID_RECORD_MGT : 0x0018,
  96. ID_X509_PKCS7_RL : 0x0019,
  97. ID_IBM1 : 0x0065,
  98. ID_IBM2 : 0x0066,
  99. ID_POSZIP : 0x4690,
  100. EF_ZIP64_OR_32 : 0xffffffff,
  101. EF_ZIP64_OR_16 : 0xffff,
  102. EF_ZIP64_SUNCOMP : 0,
  103. EF_ZIP64_SCOMP : 8,
  104. EF_ZIP64_RHO : 16,
  105. EF_ZIP64_DSN : 24
  106. };