zip 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. #------------------------------------------------------------------------------
  2. # $File: zip,v 1.7 2021/04/26 15:56:00 christos Exp $
  3. # zip: file(1) magic for zip files; this is not use
  4. # Note the version of magic in archive is currently stronger, this is
  5. # just an example until negative offsets are supported better
  6. # Zip Central Directory record
  7. 0 name zipcd
  8. >0 string PK\001\002 Zip archive data
  9. !:mime application/zip
  10. >>4 leshort x \b, made by
  11. >>4 use zipversion
  12. >>4 use ziphost
  13. >>6 leshort x \b, extract using at least
  14. >>6 use zipversion
  15. >>12 ledate x \b, last modified %s
  16. >>24 lelong >0 \b, uncompressed size %d
  17. >>10 leshort x \b, method=
  18. >>10 use zipcompression
  19. # URL: https://en.wikipedia.org/wiki/Zip_(file_format)
  20. # reference: https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT (Version: 6.3.9)
  21. # Zip known compressions
  22. 0 name zipcompression
  23. >0 leshort 0 \bstore
  24. >0 leshort 1 \bShrinking
  25. >0 leshort 6 \bImploding
  26. >0 leshort 7 \bTokenizing
  27. >0 leshort 8 \bdeflate
  28. >0 leshort 9 \bdeflate64
  29. >0 leshort 10 \bLibrary imploding
  30. #>0 leshort 11 \bReserved by PKWARE
  31. >0 leshort 12 \bbzip2
  32. #>0 leshort 13 \bReserved by PKWARE
  33. >0 leshort 14 \blzma
  34. #>0 leshort 15 \bReserved by PKWARE
  35. >0 leshort 16 \bCMPSC (IBM z/OS)
  36. #>0 leshort 17 \bReserved by PKWARE
  37. >0 leshort 18 \bIBM TERSE
  38. >0 leshort 19 \bIBM LZ77 (z/Architecture)
  39. >0 leshort 20 \bZstd (deprecated)
  40. >0 leshort 93 \bZstd
  41. >0 leshort 94 \bMP3
  42. >0 leshort 95 \bxz
  43. >0 leshort 96 \bJpeg
  44. >0 leshort 97 \bWavPack
  45. >0 leshort 98 \bPPMd
  46. >0 leshort 99 \bAES Encrypted
  47. >0 default x
  48. >>0 leshort x \b[%#x]
  49. # Zip known versions
  50. 0 name zipversion
  51. # The lower byte indicates the ZIP version of this file. The value/10 indicates
  52. # the major version number, and the value mod 10 is the minor version number.
  53. >0 ubyte/10 x v%u
  54. >0 ubyte%10 x \b.%u
  55. # >0 leshort 0x09 v0.9
  56. # >0 leshort 0x0a v1.0
  57. # >0 leshort 0x0b v1.1
  58. # >0 leshort 0x14 v2.0
  59. # >0 leshort 0x15 v2.1
  60. # >0 leshort 0x19 v2.5
  61. # >0 leshort 0x1b v2.7
  62. # >0 leshort 0x2d v4.5
  63. # >0 leshort 0x2e v4.6
  64. # >0 leshort 0x32 v5.0
  65. # >0 leshort 0x33 v5.1
  66. # >0 leshort 0x34 v5.2
  67. # >0 leshort 0x3d v6.1
  68. # >0 leshort 0x3e v6.2
  69. # >0 leshort 0x3f v6.3
  70. # >0 default x
  71. # >>0 leshort x v?[%#x]
  72. # display compatible host system name of ZIP archive
  73. 0 name ziphost
  74. # The upper byte indicates the compatibility of the file attribute information.
  75. # If the file is compatible with MS-DOS (v 2.04g) then this value will be zero.
  76. #>1 ubyte 0 DOS
  77. >1 ubyte 1 Amiga
  78. >1 ubyte 2 OpenVMS
  79. >1 ubyte 3 UNIX
  80. >1 ubyte 4 VM/CMS
  81. >1 ubyte 6 OS/2
  82. >1 ubyte 7 Macintosh
  83. >1 ubyte 11 MVS
  84. >1 ubyte 13 Acorn Risc
  85. >1 ubyte 16 BeOS
  86. >1 ubyte 17 Tandem
  87. # 9 untested
  88. >1 ubyte 5 Atari ST
  89. >1 ubyte 8 Z-System
  90. >1 ubyte 9 CP/M
  91. >1 ubyte 10 Windows NTFS
  92. >1 ubyte 12 VSE
  93. >1 ubyte 14 VFAT
  94. >1 ubyte 15 alternate MVS
  95. >1 ubyte 18 OS/400
  96. >1 ubyte 19 OS X
  97. # unused
  98. #>1 ubyte >19 unused %#x
  99. # Zip End Of Central Directory record
  100. -22 string PK\005\006
  101. #>4 leshort >1 \b, %d disks
  102. #>6 leshort >1 \b, central directory disk %d
  103. #>8 leshort >1 \b, %d central directories on this disk
  104. #>10 leshort >1 \b, %d central directories
  105. #>12 lelong x \b, %d central directory bytes
  106. >(16.l) use zipcd
  107. >>20 pstring/l >0 \b, %s