@@ -8,65 +8,67 @@ const (
88)
99
1010var (
11- TypeEpub = newType ("epub" , "application/epub+zip" )
12- TypeZip = newType ("zip" , "application/zip" )
13- TypeTar = newType ("tar" , "application/x-tar" )
14- TypeRar = newType ("rar" , "application/vnd.rar" )
15- TypeGz = newType ("gz" , "application/gzip" )
16- TypeBz2 = newType ("bz2" , "application/x-bzip2" )
17- Type7z = newType ("7z" , "application/x-7z-compressed" )
18- TypeXz = newType ("xz" , "application/x-xz" )
19- TypeZstd = newType ("zst" , "application/zstd" )
20- TypePdf = newType ("pdf" , "application/pdf" )
21- TypeExe = newType ("exe" , "application/vnd.microsoft.portable-executable" )
22- TypeSwf = newType ("swf" , "application/x-shockwave-flash" )
23- TypeRtf = newType ("rtf" , "application/rtf" )
24- TypeEot = newType ("eot" , "application/octet-stream" )
25- TypePs = newType ("ps" , "application/postscript" )
26- TypeSqlite = newType ("sqlite" , "application/vnd.sqlite3" )
27- TypeNes = newType ("nes" , "application/x-nintendo-nes-rom" )
28- TypeCrx = newType ("crx" , "application/x-google-chrome-extension" )
29- TypeCab = newType ("cab" , "application/vnd.ms-cab-compressed" )
30- TypeDeb = newType ("deb" , "application/vnd.debian.binary-package" )
31- TypeAr = newType ("ar" , "application/x-unix-archive" )
32- TypeZ = newType ("Z" , "application/x-compress" )
33- TypeLz = newType ("lz" , "application/x-lzip" )
34- TypeRpm = newType ("rpm" , "application/x-rpm" )
35- TypeElf = newType ("elf" , "application/x-executable" )
36- TypeDcm = newType ("dcm" , "application/dicom" )
37- TypeIso = newType ("iso" , "application/x-iso9660-image" )
38- TypeMachO = newType ("macho" , "application/x-mach-binary" ) // Mach-O binaries have no common extension.
11+ TypeEpub = newType ("epub" , "application/epub+zip" )
12+ TypeZip = newType ("zip" , "application/zip" )
13+ TypeTar = newType ("tar" , "application/x-tar" )
14+ TypeRar = newType ("rar" , "application/vnd.rar" )
15+ TypeGz = newType ("gz" , "application/gzip" )
16+ TypeBz2 = newType ("bz2" , "application/x-bzip2" )
17+ Type7z = newType ("7z" , "application/x-7z-compressed" )
18+ TypeXz = newType ("xz" , "application/x-xz" )
19+ TypeZstd = newType ("zst" , "application/zstd" )
20+ TypePdf = newType ("pdf" , "application/pdf" )
21+ TypeExe = newType ("exe" , "application/vnd.microsoft.portable-executable" )
22+ TypeSwf = newType ("swf" , "application/x-shockwave-flash" )
23+ TypeRtf = newType ("rtf" , "application/rtf" )
24+ TypeEot = newType ("eot" , "application/octet-stream" )
25+ TypePs = newType ("ps" , "application/postscript" )
26+ TypeSqlite = newType ("sqlite" , "application/vnd.sqlite3" )
27+ TypeNes = newType ("nes" , "application/x-nintendo-nes-rom" )
28+ TypeCrx = newType ("crx" , "application/x-google-chrome-extension" )
29+ TypeCab = newType ("cab" , "application/vnd.ms-cab-compressed" )
30+ TypeDeb = newType ("deb" , "application/vnd.debian.binary-package" )
31+ TypeAr = newType ("ar" , "application/x-unix-archive" )
32+ TypeZ = newType ("Z" , "application/x-compress" )
33+ TypeLz = newType ("lz" , "application/x-lzip" )
34+ TypeRpm = newType ("rpm" , "application/x-rpm" )
35+ TypeElf = newType ("elf" , "application/x-executable" )
36+ TypeDcm = newType ("dcm" , "application/dicom" )
37+ TypeIso = newType ("iso" , "application/x-iso9660-image" )
38+ TypeMachO = newType ("macho" , "application/x-mach-binary" ) // Mach-O binaries have no common extension.
39+ TypeParquet = newType ("parquet" , "application/vnd.apache.parquet" )
3940)
4041
4142var Archive = Map {
42- TypeEpub : bytePrefixMatcher (epubMagic ),
43- TypeZip : Zip ,
44- TypeTar : Tar ,
45- TypeRar : Rar ,
46- TypeGz : bytePrefixMatcher (gzMagic ),
47- TypeBz2 : bytePrefixMatcher (bz2Magic ),
48- Type7z : bytePrefixMatcher (sevenzMagic ),
49- TypeXz : bytePrefixMatcher (xzMagic ),
50- TypeZstd : Zst ,
51- TypePdf : bytePrefixMatcher (pdfMagic ),
52- TypeExe : bytePrefixMatcher (exeMagic ),
53- TypeSwf : Swf ,
54- TypeRtf : bytePrefixMatcher (rtfMagic ),
55- TypeEot : Eot ,
56- TypePs : bytePrefixMatcher (psMagic ),
57- TypeSqlite : bytePrefixMatcher (sqliteMagic ),
58- TypeNes : bytePrefixMatcher (nesMagic ),
59- TypeCrx : bytePrefixMatcher (crxMagic ),
60- TypeCab : Cab ,
61- TypeDeb : bytePrefixMatcher (debMagic ),
62- TypeAr : bytePrefixMatcher (arMagic ),
63- TypeZ : Z ,
64- TypeLz : bytePrefixMatcher (lzMagic ),
65- TypeRpm : Rpm ,
66- TypeElf : Elf ,
67- TypeDcm : Dcm ,
68- TypeIso : Iso ,
69- TypeMachO : MachO ,
43+ TypeEpub : bytePrefixMatcher (epubMagic ),
44+ TypeZip : Zip ,
45+ TypeTar : Tar ,
46+ TypeRar : Rar ,
47+ TypeGz : bytePrefixMatcher (gzMagic ),
48+ TypeBz2 : bytePrefixMatcher (bz2Magic ),
49+ Type7z : bytePrefixMatcher (sevenzMagic ),
50+ TypeXz : bytePrefixMatcher (xzMagic ),
51+ TypeZstd : Zst ,
52+ TypePdf : bytePrefixMatcher (pdfMagic ),
53+ TypeExe : bytePrefixMatcher (exeMagic ),
54+ TypeSwf : Swf ,
55+ TypeRtf : bytePrefixMatcher (rtfMagic ),
56+ TypeEot : Eot ,
57+ TypePs : bytePrefixMatcher (psMagic ),
58+ TypeSqlite : bytePrefixMatcher (sqliteMagic ),
59+ TypeNes : bytePrefixMatcher (nesMagic ),
60+ TypeCrx : bytePrefixMatcher (crxMagic ),
61+ TypeCab : Cab ,
62+ TypeDeb : bytePrefixMatcher (debMagic ),
63+ TypeAr : bytePrefixMatcher (arMagic ),
64+ TypeZ : Z ,
65+ TypeLz : bytePrefixMatcher (lzMagic ),
66+ TypeRpm : Rpm ,
67+ TypeElf : Elf ,
68+ TypeDcm : Dcm ,
69+ TypeIso : Iso ,
70+ TypeMachO : MachO ,
71+ TypeParquet : bytePrefixMatcher (parquetMagic ),
7072}
7173
7274var (
9294 0x64 , 0x65 , 0x62 , 0x69 , 0x61 , 0x6E , 0x2D , 0x62 ,
9395 0x69 , 0x6E , 0x61 , 0x72 , 0x79 ,
9496 }
95- arMagic = []byte {0x21 , 0x3C , 0x61 , 0x72 , 0x63 , 0x68 , 0x3E }
96- zstdMagic = []byte {0x28 , 0xB5 , 0x2F , 0xFD }
97- lzMagic = []byte {0x4C , 0x5A , 0x49 , 0x50 }
97+ arMagic = []byte {0x21 , 0x3C , 0x61 , 0x72 , 0x63 , 0x68 , 0x3E }
98+ zstdMagic = []byte {0x28 , 0xB5 , 0x2F , 0xFD }
99+ lzMagic = []byte {0x4C , 0x5A , 0x49 , 0x50 }
100+ parquetMagic = []byte {0x50 , 0x41 , 0x52 , 0x31 }
98101)
99102
100103func bytePrefixMatcher (magicPattern []byte ) Matcher {
0 commit comments