├── .gitignore ├── .swiftformat ├── .swiftpm └── xcode │ └── package.xcworkspace │ └── contents.xcworkspacedata ├── Package.swift ├── README.md ├── Sources └── FileType │ ├── Data+Int.swift │ ├── Data+String.swift │ ├── FileType.swift │ ├── FileTypeExtension.swift │ ├── FileTypeMatch.swift │ ├── asar.swift │ ├── asf.swift │ ├── mkv.swift │ ├── mpeg.swift │ ├── png.swift │ ├── tar.swift │ ├── util.swift │ └── zip+office.swift └── Tests ├── FileTypeTests ├── FileTypeTests.swift └── XCTestManifests.swift ├── Fixtures ├── fixture-0x20001.eot ├── fixture-2.doc.cfb ├── fixture-adobe-illustrator.pdf ├── fixture-adts-mpeg2.aac ├── fixture-adts-mpeg4-2.aac ├── fixture-adts-mpeg4.aac ├── fixture-babys-songbook.m4b.m4a ├── fixture-bdav.mts ├── fixture-big-endian.mie ├── fixture-big-endian.pcap ├── fixture-big-endian.tif ├── fixture-corrupt.mkv ├── fixture-corrupt.png ├── fixture-crlf.epub ├── fixture-dash.mp4 ├── fixture-doc.msi ├── fixture-fast-web.pdf ├── fixture-ffe3.mp3 ├── fixture-heic.heic ├── fixture-id3v2.aac ├── fixture-id3v2.flac ├── fixture-imovie.mp4 ├── fixture-isom.mp4 ├── fixture-isomv2.mp4 ├── fixture-itxt.png ├── fixture-little-endian.mie ├── fixture-little-endian.pcap ├── fixture-little-endian.tif ├── fixture-mif1.heic ├── fixture-mjpeg.mov ├── fixture-monkeysaudio.ape ├── fixture-moov.mov ├── fixture-mp2l3.mp3 ├── fixture-mp4v2.mp4 ├── fixture-mpa.mp2 ├── fixture-msf1.heic ├── fixture-null.webm ├── fixture-office365.docx ├── fixture-office365.pptx ├── fixture-office365.xlsx ├── fixture-otto.woff ├── fixture-otto.woff2 ├── fixture-ppt.msi ├── fixture-printed.pdf ├── fixture-raw.mts ├── fixture-sequence.avif ├── fixture-smallest.pdf ├── fixture-spaces.tar ├── fixture-sv7.mpc ├── fixture-sv8.mpc ├── fixture-unknown-ogg.ogx ├── fixture-utf16-be-bom.xml ├── fixture-utf16-le-bom.xml ├── fixture-utf8-bom.xml ├── fixture-v7.tar ├── fixture-without-pdf-compatibility.ai ├── fixture-xls.msi ├── fixture-yuv420-8bit.avif ├── fixture.3g2 ├── fixture.3gp ├── fixture.3mf ├── fixture.7z ├── fixture.ac3 ├── fixture.ai ├── fixture.aif ├── fixture.alias ├── fixture.amr ├── fixture.apng ├── fixture.ar ├── fixture.arrow ├── fixture.arw ├── fixture.asar ├── fixture.asf ├── fixture.avi ├── fixture.blend ├── fixture.bmp ├── fixture.bpg ├── fixture.bz2 ├── fixture.cab ├── fixture.chm ├── fixture.cr2 ├── fixture.cr3 ├── fixture.crx ├── fixture.cur ├── fixture.dcm ├── fixture.deb ├── fixture.dmg ├── fixture.dng ├── fixture.doc.cfb ├── fixture.docx ├── fixture.dsf ├── fixture.elf ├── fixture.eot ├── fixture.eps ├── fixture.epub ├── fixture.exe ├── fixture.f4a ├── fixture.f4b ├── fixture.f4p ├── fixture.f4v ├── fixture.flac ├── fixture.flif ├── fixture.flv ├── fixture.gif ├── fixture.glb ├── fixture.icns ├── fixture.ico ├── fixture.ics ├── fixture.indd ├── fixture.it ├── fixture.jp2 ├── fixture.jpg ├── fixture.jpm ├── fixture.jpx ├── fixture.jxl ├── fixture.jxr ├── fixture.ktx ├── fixture.lnk ├── fixture.lzh ├── fixture.m4a ├── fixture.m4b ├── fixture.m4p ├── fixture.m4v ├── fixture.mid ├── fixture.mj2 ├── fixture.mkv ├── fixture.mobi ├── fixture.mov ├── fixture.mp1 ├── fixture.mp2 ├── fixture.mp3 ├── fixture.mp4 ├── fixture.mpg ├── fixture.msi ├── fixture.msi.cfb ├── fixture.mts ├── fixture.mxf ├── fixture.nef ├── fixture.nes ├── fixture.odp ├── fixture.ods ├── fixture.odt ├── fixture.oga ├── fixture.ogg ├── fixture.ogm ├── fixture.ogv ├── fixture.opus ├── fixture.orf ├── fixture.otf ├── fixture.pdf ├── fixture.pgp ├── fixture.png ├── fixture.ppt.cfb ├── fixture.pptx ├── fixture.ps ├── fixture.ps.mpg ├── fixture.psd ├── fixture.qcp ├── fixture.raf ├── fixture.rar ├── fixture.rpm ├── fixture.rtf ├── fixture.rw2 ├── fixture.s3m ├── fixture.shp ├── fixture.skp ├── fixture.spx ├── fixture.sqlite ├── fixture.stl ├── fixture.sub.mpg ├── fixture.swf ├── fixture.tar ├── fixture.tar.Z ├── fixture.tar.gz ├── fixture.tar.lz ├── fixture.tar.xz ├── fixture.tif ├── fixture.ttf ├── fixture.vcf ├── fixture.voc ├── fixture.wasm ├── fixture.wav ├── fixture.webm ├── fixture.webp ├── fixture.wma.asf ├── fixture.wmv.asf ├── fixture.woff ├── fixture.woff2 ├── fixture.wv ├── fixture.xcf ├── fixture.xls.cfb ├── fixture.xlsx ├── fixture.xm ├── fixture.xml ├── fixture.xpi ├── fixture.zip ├── fixture.zst ├── fixture2.3gp ├── fixture2.arw ├── fixture2.dng ├── fixture2.docx ├── fixture2.eps ├── fixture2.jxl ├── fixture2.mkv ├── fixture2.mpg ├── fixture2.nef ├── fixture2.pptx ├── fixture2.xlsx ├── fixture3.arw ├── fixture3.nef ├── fixture4.arw ├── fixture4.nef └── fixture5.arw └── LinuxMain.swift /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | xcuserdata/ 6 | -------------------------------------------------------------------------------- /.swiftformat: -------------------------------------------------------------------------------- 1 | --indent 2 2 | --indentcase true 3 | --swiftversion 5.5.2 4 | -------------------------------------------------------------------------------- /.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:5.6 2 | import PackageDescription 3 | 4 | let package = Package( 5 | name: "FileType", 6 | products: [ 7 | .library( 8 | name: "FileType", 9 | targets: ["FileType"] 10 | ), 11 | ], 12 | targets: [ 13 | .target( 14 | name: "FileType" 15 | ), 16 | .testTarget( 17 | name: "FileTypeTests", 18 | dependencies: ["FileType"] 19 | ), 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # FileType 2 | 3 | The file type is detected by checking the magic number of the data. 4 | 5 | This is swift port of [file-type](https://github.com/sindresorhus/file-type) 6 | 7 | ## Installation 8 | 9 | ### Swift Package Manager 10 | 11 | ```swift 12 | import PackageDescription 13 | 14 | let package = Package( 15 | name: "MyApp", 16 | dependencies: [ 17 | .package(url: "https://github.com/velocityzen/FileType", from: "1.0.3") 18 | ] 19 | ) 20 | ``` 21 | 22 | ## Usage 23 | 24 | Inspect mime type 25 | 26 | ```swift 27 | import FileType 28 | 29 | let path = "/path/to/some-file.jpg" 30 | let url = URL(fileURLWithPath: path, isDirectory: false) 31 | let data = try! Data(contentsOf: url) 32 | let fileType = FileType.getFor(data: data) 33 | 34 | fileType?.type == .jpg // true 35 | fileType! // FileType(type: .jpg, ext: "jpg", mime: "image/jpeg") 36 | 37 | ``` 38 | 39 | ### .getFor(type: FileTypeExtension) -> [FileType] 40 | 41 | returns all file types and mime information 42 | 43 | ### .getFor(data: Data) -> FileType? 44 | 45 | returns file type detected by checking the magic number 46 | 47 | ### .getBytesCountFor(type: FileTypeExtension) -> Int 48 | 49 | returns bytes count needed to detect file type 50 | 51 | ### .getBytesCountFor(types: [FileTypeExtension]) -> Int 52 | 53 | returns max bytes count needed to detect file types 54 | 55 | ## Supported file types 56 | 57 | - [`3g2`](https://en.wikipedia.org/wiki/3GP_and_3G2#3G2) - Multimedia container format defined by the 3GPP2 for 3G CDMA2000 multimedia services 58 | - [`3gp`](https://en.wikipedia.org/wiki/3GP_and_3G2#3GP) - Multimedia container format defined by the Third Generation Partnership Project (3GPP) for 3G UMTS multimedia services 59 | - [`3mf`](https://en.wikipedia.org/wiki/3D_Manufacturing_Format) - 3D Manufacturing Format 60 | - [`7z`](https://en.wikipedia.org/wiki/7z) 61 | - [`aac`](https://en.wikipedia.org/wiki/Advanced_Audio_Coding) - Advanced Audio Coding 62 | - [`ac3`](https://www.atsc.org/standard/a522012-digital-audio-compression-ac-3-e-ac-3-standard-12172012/) - ATSC A/52 Audio File 63 | - [`ai`](https://en.wikipedia.org/wiki/Adobe_Illustrator_Artwork) - Adobe Illustrator Artwork 64 | - [`aif`](https://en.wikipedia.org/wiki/Audio_Interchange_File_Format) 65 | - [`alias`](https://en.wikipedia.org/wiki/Alias_%28Mac_OS%29) - macOS Alias file 66 | - [`amr`](https://en.wikipedia.org/wiki/Adaptive_Multi-Rate_audio_codec) 67 | - [`ape`](https://en.wikipedia.org/wiki/Monkey%27s_Audio) - Monkey's Audio 68 | - [`apng`](https://en.wikipedia.org/wiki/APNG) - Animated Portable Network Graphics 69 | - [`ar`]() 70 | - [`arrow`](https://arrow.apache.org) - Columnar format for tables of data 71 | - [`arw`](https://en.wikipedia.org/wiki/Raw_image_format#ARW) - Sony Alpha Raw image file 72 | - [`asar`](https://github.com/electron/asar) - Simple extensive tar-like archive format with indexing 73 | - [`asf`](https://en.wikipedia.org/wiki/Advanced_Systems_Format) - Advanced Systems Format 74 | - [`avi`](https://en.wikipedia.org/wiki/Audio_Video_Interleave) 75 | - [`avif`]() - AV1 Image File Format 76 | - [`blend`](https://wiki.blender.org/index.php/Dev:Source/Architecture/File_Format) 77 | - [`bmp`](https://en.wikipedia.org/wiki/BMP_file_format) 78 | - [`bpg`](https://bellard.org/bpg/) 79 | - [`bz2`](https://en.wikipedia.org/wiki/Bzip2) 80 | - [`cab`]() 81 | - [`cfb`](https://en.wikipedia.org/wiki/Compound_File_Binary_Format) 82 | - [`chm`](https://en.wikipedia.org/wiki/Microsoft_Compiled_HTML_Help) - Microsoft Compiled HTML Help 83 | - [`cr2`](https://fileinfo.com/extension/cr2) - Canon Raw image file (v2) 84 | - [`cr3`](https://fileinfo.com/extension/cr3) - Canon Raw image file (v3) 85 | - [`crx`](https://developer.chrome.com/extensions/crx) 86 | - [`cur`]() 87 | - [`dcm`](https://en.wikipedia.org/wiki/DICOM#Data_format) - DICOM Image File 88 | - [`deb`]() 89 | - [`dmg`](https://en.wikipedia.org/wiki/Apple_Disk_Image) 90 | - [`dng`](https://en.wikipedia.org/wiki/Digital_Negative) - Adobe Digital Negative image file 91 | - [`docx`](https://en.wikipedia.org/wiki/Office_Open_XML) 92 | - [`dsf`](https://dsd-guide.com/sites/default/files/white-papers/DSFFileFormatSpec_E.pdf) - Sony DSD Stream File (DSF) 93 | - [`elf`](https://en.wikipedia.org/wiki/Executable_and_Linkable_Format) - Unix Executable and Linkable Format 94 | - [`eot`](https://en.wikipedia.org/wiki/Embedded_OpenType) 95 | - [`eps`](https://en.wikipedia.org/wiki/Encapsulated_PostScript) - Encapsulated PostScript 96 | - [`epub`](https://en.wikipedia.org/wiki/EPUB) 97 | - [`exe`](https://en.wikipedia.org/wiki/.exe) 98 | - [`f4a`](https://en.wikipedia.org/wiki/Flash_Video) - Audio-only ISO base media file format used by Adobe Flash Player 99 | - [`f4b`](https://en.wikipedia.org/wiki/Flash_Video) - Audiobook and podcast ISO base media file format used by Adobe Flash Player 100 | - [`f4p`](https://en.wikipedia.org/wiki/Flash_Video) - ISO base media file format protected by Adobe Access DRM used by Adobe Flash Player 101 | - [`f4v`](https://en.wikipedia.org/wiki/Flash_Video) - ISO base media file format used by Adobe Flash Player 102 | - [`flac`](https://en.wikipedia.org/wiki/FLAC) 103 | - [`flif`](https://en.wikipedia.org/wiki/Free_Lossless_Image_Format) 104 | - [`flv`](https://en.wikipedia.org/wiki/Flash_Video) 105 | - [`gif`](https://en.wikipedia.org/wiki/GIF) 106 | - [`glb`](https://github.com/KhronosGroup/glTF) - GL Transmission Format 107 | - [`gz`](https://en.wikipedia.org/wiki/Gzip) 108 | - [`heic`](https://nokiatech.github.io/heif/technical.html) 109 | - [`icns`](https://en.wikipedia.org/wiki/Apple_Icon_Image_format) 110 | - [`ico`]() 111 | - [`ics`](https://en.wikipedia.org/wiki/ICalendar#Data_format) - iCalendar 112 | - [`indd`](https://en.wikipedia.org/wiki/Adobe_InDesign#File_format) 113 | - [`it`](https://wiki.openmpt.org/Manual:_Module_formats#The_Impulse_Tracker_format_.28.it.29) - Audio module format: Impulse Tracker 114 | - [`jp2`](https://en.wikipedia.org/wiki/JPEG_2000) - JPEG 2000 115 | - [`jpg`](https://en.wikipedia.org/wiki/JPEG) 116 | - [`jpm`](https://en.wikipedia.org/wiki/JPEG_2000) - JPEG 2000 117 | - [`jpx`](https://en.wikipedia.org/wiki/JPEG_2000) - JPEG 2000 118 | - [`jxl`](https://en.wikipedia.org/wiki/JPEG_XL) - JPEG XL image format 119 | - [`jxr`](https://en.wikipedia.org/wiki/JPEG_XR) 120 | - [`ktx`](https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/) 121 | - [`lnk`](https://en.wikipedia.org/wiki/Shortcut_%28computing%29#Microsoft_Windows) - Microsoft Windows file shortcut 122 | - [`lz`](https://en.wikipedia.org/wiki/Lzip) 123 | - [`lzh`]() - LZH archive 124 | - [`m4a`](https://en.wikipedia.org/wiki/M4A) - Audio-only MPEG-4 files 125 | - [`m4b`](https://en.wikipedia.org/wiki/M4B) - Audiobook and podcast MPEG-4 files, which also contain metadata including chapter markers, images, and hyperlinks 126 | - [`m4p`](https://en.wikipedia.org/wiki/MPEG-4_Part_14#Filename_extensions) - MPEG-4 files with audio streams encrypted by FairPlay Digital Rights Management as were sold through the iTunes Store 127 | - [`m4v`](https://en.wikipedia.org/wiki/M4V) - MPEG-4 Visual bitstreams 128 | - [`mid`](https://en.wikipedia.org/wiki/MIDI) 129 | - [`mie`](https://en.wikipedia.org/wiki/Sidecar_file) - Dedicated meta information format which supports storage of binary as well as textual meta information 130 | - [`mj2`](https://en.wikipedia.org/wiki/Motion_JPEG_2000) - Motion JPEG 2000 131 | - [`mkv`](https://en.wikipedia.org/wiki/Matroska) 132 | - [`mobi`](https://en.wikipedia.org/wiki/Mobipocket) - Mobipocket 133 | - [`mov`](https://en.wikipedia.org/wiki/QuickTime_File_Format) 134 | - [`mp1`](https://en.wikipedia.org/wiki/MPEG-1_Audio_Layer_I) - MPEG-1 Audio Layer I 135 | - [`mp2`](https://en.wikipedia.org/wiki/MPEG-1_Audio_Layer_II) 136 | - [`mp3`](https://en.wikipedia.org/wiki/MP3) 137 | - [`mp4`](https://en.wikipedia.org/wiki/MPEG-4_Part_14#Filename_extensions) 138 | - [`mpc`](https://en.wikipedia.org/wiki/Musepack) - Musepack (SV7 & SV8) 139 | - [`mpg`](https://en.wikipedia.org/wiki/MPEG-1) 140 | - [`mts`](https://en.wikipedia.org/wiki/.m2ts) - MPEG-2 Transport Stream, both raw and Blu-ray Disc Audio-Video (BDAV) versions 141 | - [`mxf`](https://en.wikipedia.org/wiki/Material_Exchange_Format) 142 | - [`nef`](https://www.nikonusa.com/en/learn-and-explore/a/products-and-innovation/nikon-electronic-format-nef.html) - Nikon Electronic Format image file 143 | - [`nes`](https://fileinfo.com/extension/nes) 144 | - [`odp`](https://en.wikipedia.org/wiki/OpenDocument) - OpenDocument for presentations 145 | - [`ods`](https://en.wikipedia.org/wiki/OpenDocument) - OpenDocument for spreadsheets 146 | - [`odt`](https://en.wikipedia.org/wiki/OpenDocument) - OpenDocument for word processing 147 | - [`oga`](https://en.wikipedia.org/wiki/Ogg) 148 | - [`ogg`](https://en.wikipedia.org/wiki/Ogg) 149 | - [`ogm`](https://en.wikipedia.org/wiki/Ogg) 150 | - [`ogv`](https://en.wikipedia.org/wiki/Ogg) 151 | - [`ogx`](https://en.wikipedia.org/wiki/Ogg) 152 | - [`opus`]() 153 | - [`orf`](https://en.wikipedia.org/wiki/ORF_format) - Olympus Raw image file 154 | - [`otf`](https://en.wikipedia.org/wiki/OpenType) 155 | - [`pcap`](https://wiki.wireshark.org/Development/LibpcapFileFormat) - Libpcap File Format 156 | - [`pdf`](https://en.wikipedia.org/wiki/Portable_Document_Format) 157 | - [`pgp`](https://en.wikipedia.org/wiki/Pretty_Good_Privacy) - Pretty Good Privacy 158 | - [`png`](https://en.wikipedia.org/wiki/Portable_Network_Graphics) 159 | - [`pptx`](https://en.wikipedia.org/wiki/Office_Open_XML) 160 | - [`ps`](https://en.wikipedia.org/wiki/Postscript) 161 | - [`psd`](https://en.wikipedia.org/wiki/Adobe_Photoshop#File_format) 162 | - [`qcp`](https://en.wikipedia.org/wiki/QCP) 163 | - [`raf`](https://en.wikipedia.org/wiki/Raw_image_format) - Fujifilm RAW image file 164 | - [`rar`]() 165 | - [`rpm`](https://fileinfo.com/extension/rpm) 166 | - [`rtf`](https://en.wikipedia.org/wiki/Rich_Text_Format) 167 | - [`rw2`](https://en.wikipedia.org/wiki/Raw_image_format) - Panasonic RAW image file 168 | - [`s3m`](https://wiki.openmpt.org/Manual:_Module_formats#The_ScreamTracker_3_format_.28.s3m.29) - Audio module format: ScreamTracker 3 169 | - [`shp`](https://en.wikipedia.org/wiki/Shapefile) - Geospatial vector data format 170 | - [`skp`](https://en.wikipedia.org/wiki/SketchUp) - SketchUp 171 | - [`spx`](https://en.wikipedia.org/wiki/Ogg) 172 | - [`sqlite`](https://www.sqlite.org/fileformat2.html) 173 | - [`stl`]() - Standard Tesselated Geometry File Format (ASCII only) 174 | - [`swf`](https://en.wikipedia.org/wiki/SWF) 175 | - [`tar`]() 176 | - [`tif`](https://en.wikipedia.org/wiki/Tagged_Image_File_Format) 177 | - [`ttf`](https://en.wikipedia.org/wiki/TrueType) 178 | - [`vcf`](https://en.wikipedia.org/wiki/VCard) - vCard 179 | - [`voc`](https://wiki.multimedia.cx/index.php/Creative_Voice) - Creative Voice File 180 | - [`wasm`](https://en.wikipedia.org/wiki/WebAssembly) 181 | - [`wav`](https://en.wikipedia.org/wiki/WAV) 182 | - [`webm`](https://en.wikipedia.org/wiki/WebM) 183 | - [`webp`](https://en.wikipedia.org/wiki/WebP) 184 | - [`woff2`](https://en.wikipedia.org/wiki/Web_Open_Font_Format) 185 | - [`woff`](https://en.wikipedia.org/wiki/Web_Open_Font_Format) 186 | - [`wv`](https://en.wikipedia.org/wiki/WavPack) - WavPack 187 | - [`xcf`]() - eXperimental Computing Facility 188 | - [`xlsx`](https://en.wikipedia.org/wiki/Office_Open_XML) 189 | - [`xm`](https://wiki.openmpt.org/Manual:_Module_formats#The_FastTracker_2_format_.28.xm.29) - Audio module format: FastTracker 2 190 | - [`xml`](https://en.wikipedia.org/wiki/XML) 191 | - [`xpi`](https://en.wikipedia.org/wiki/XPInstall) 192 | - [`xz`](https://en.wikipedia.org/wiki/Xz) 193 | - [`Z`](https://fileinfo.com/extension/z) 194 | - [`zip`]() 195 | - [`zst`](https://en.wikipedia.org/wiki/Zstandard) - Archive file 196 | 197 | _Pull requests are welcome for additional commonly used file types._ 198 | 199 | ## Testing 200 | 201 | ``` 202 | swift test 203 | ``` 204 | -------------------------------------------------------------------------------- /Sources/FileType/Data+Int.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | internal extension Data { 4 | func getInt16LE(offset: Int = 0) -> Int { 5 | Int( 6 | UInt16(self[offset]) | 7 | (UInt16(self[offset + 1]) << 8) 8 | ) 9 | } 10 | 11 | func getInt16BE(offset: Int = 0) -> Int { 12 | Int( 13 | UInt16(self[offset]) << 8 | 14 | UInt16(self[offset + 1]) 15 | ) 16 | } 17 | 18 | func getInt32BE(offset: Int = 0) -> Int { 19 | Int( 20 | (UInt32(self[offset]) << 24) | 21 | (UInt32(self[offset + 1]) << 16) | 22 | (UInt32(self[offset + 2]) << 8) | 23 | UInt32(self[offset + 3]) 24 | ) 25 | } 26 | 27 | func getInt32LE(offset: Int = 0) -> Int { 28 | Int( 29 | UInt32(self[offset]) | 30 | (UInt32(self[offset + 1]) << 8) | 31 | (UInt32(self[offset + 2]) << 16) | 32 | (UInt32(self[offset + 3]) << 24) 33 | ) 34 | } 35 | 36 | func getInt64BE(offset: Int = 0) -> Int { 37 | let number = (UInt64(self[offset]) << 32) | 38 | (UInt64(self[offset + 1]) << 24) | 39 | (UInt64(self[offset + 2]) << 16) | 40 | (UInt64(self[offset + 3]) << 8) | 41 | UInt64(self[offset + 4]) 42 | 43 | return Int(number) 44 | } 45 | 46 | func getInt64LE(offset: Int = 0) -> Int { 47 | let number = UInt64(self[offset]) | 48 | (UInt64(self[offset + 1]) << 8) | 49 | (UInt64(self[offset + 2]) << 16) | 50 | (UInt64(self[offset + 3]) << 24) | 51 | (UInt64(self[offset + 4]) << 32) 52 | 53 | return Int(number) 54 | } 55 | 56 | /** 57 | ID3 UINT32 sync-safe tokenizer token. 58 | 28 bits (representing up to 256MB) integer, the msb is 0 to avoid "false syncsignals". 59 | */ 60 | func getUInt32SyncSafeToken(offset: Int = 0) -> Int { 61 | Int( 62 | UInt32(self[offset + 3]) & 0x7F | 63 | UInt32(self[offset + 2]) << 7 | 64 | UInt32(self[offset + 1]) << 14 | 65 | UInt32(self[offset]) << 21 66 | ) 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /Sources/FileType/Data+String.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | internal extension Data { 4 | func getString(from range: Range, encoding: String.Encoding = .utf8) -> String? { 5 | guard range.endIndex <= count else { 6 | return nil 7 | } 8 | return String(data: self[range], encoding: encoding) 9 | } 10 | 11 | func getIntByteString(from range: Range) -> Int? { 12 | guard let octal = String(data: self[range], encoding: .utf8) else { 13 | return nil 14 | } 15 | 16 | return Int(octal.trimmingCharacters(in: .whitespaces), radix: 0o10) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Sources/FileType/FileType.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | public struct FileType { 4 | public let type: FileTypeExtension 5 | public let ext: String 6 | public let mime: String 7 | } 8 | 9 | private extension FileType { 10 | static let all: [FileTypeMatchType: FileType] = [ 11 | .asar: FileType( 12 | type: .asar, 13 | ext: "asar", 14 | mime: "application/x-asar" 15 | ), 16 | 17 | .bmp: FileType( 18 | type: .bmp, 19 | ext: "bmp", 20 | mime: "image/bmp" 21 | ), 22 | 23 | .ac3: FileType( 24 | type: .ac3, 25 | ext: "ac3", 26 | mime: "audio/vnd.dolby.dd-raw" 27 | ), 28 | 29 | .dmg: FileType( 30 | type: .dmg, 31 | ext: "dmg", 32 | mime: "application/x-apple-diskimage" 33 | ), 34 | 35 | .exe: FileType( 36 | type: .exe, 37 | ext: "exe", 38 | mime: "application/x-msdownload" 39 | ), 40 | 41 | .ps: FileType( 42 | type: .ps, 43 | ext: "ps", 44 | mime: "application/postscript" 45 | ), 46 | 47 | .Z: FileType( 48 | type: .Z, 49 | ext: "Z", 50 | mime: "application/x-compress" 51 | ), 52 | 53 | .jpg: FileType( 54 | type: .jpg, 55 | ext: "jpg", 56 | mime: "image/jpeg" 57 | ), 58 | 59 | .jxr: FileType( 60 | type: .jxr, 61 | ext: "jxr", 62 | mime: "image/vnd.ms-photo" 63 | ), 64 | 65 | .gz: FileType( 66 | type: .gz, 67 | ext: "gz", 68 | mime: "application/gzip" 69 | ), 70 | 71 | .bz2: FileType( 72 | type: .bz2, 73 | ext: "bz2", 74 | mime: "application/x-bzip2" 75 | ), 76 | 77 | .mpc: FileType( 78 | type: .mpc, 79 | ext: "mpc", 80 | mime: "audio/x-musepack" 81 | ), 82 | 83 | .gif: FileType( 84 | type: .gif, 85 | ext: "gif", 86 | mime: "image/gif" 87 | ), 88 | 89 | .flif: FileType( 90 | type: .flif, 91 | ext: "flif", 92 | mime: "image/flif" 93 | ), 94 | 95 | .psd: FileType( 96 | type: .psd, 97 | ext: "psd", 98 | mime: "image/vnd.adobe.photoshop" 99 | ), 100 | 101 | .aif: FileType( 102 | type: .aif, 103 | ext: "aif", 104 | mime: "audio/aiff" 105 | ), 106 | 107 | .swf: FileType( 108 | type: .swf, 109 | ext: "swf", 110 | mime: "application/x-shockwave-flash" 111 | ), 112 | 113 | .xpi: FileType( 114 | type: .xpi, 115 | ext: "xpi", 116 | mime: "application/x-xpinstall" 117 | ), 118 | 119 | .docx: FileType( 120 | type: .docx, 121 | ext: "docx", 122 | mime: "application/vnd.openxmlformats-officedocument.wordprocessingml.document" 123 | ), 124 | 125 | .pptx: FileType( 126 | type: .pptx, 127 | ext: "pptx", 128 | mime: "application/vnd.openxmlformats-officedocument.presentationml.presentation" 129 | ), 130 | 131 | .xlsx: FileType( 132 | type: .xlsx, 133 | ext: "xlsx", 134 | mime: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" 135 | ), 136 | 137 | .threemf: FileType( 138 | type: .threemf, 139 | ext: "3mf", 140 | mime: "model/3mf" 141 | ), 142 | 143 | .epub: FileType( 144 | type: .epub, 145 | ext: "epub", 146 | mime: "application/epub+zip" 147 | ), 148 | 149 | .odt: FileType( 150 | type: .odt, 151 | ext: "odt", 152 | mime: "application/vnd.oasis.opendocument.text" 153 | ), 154 | 155 | .ods: FileType( 156 | type: .ods, 157 | ext: "ods", 158 | mime: "application/vnd.oasis.opendocument.spreadsheet" 159 | ), 160 | 161 | .odp: FileType( 162 | type: .odp, 163 | ext: "odp", 164 | mime: "application/vnd.oasis.opendocument.presentation" 165 | ), 166 | 167 | .zip: FileType( 168 | type: .zip, 169 | ext: "zip", 170 | mime: "application/zip" 171 | ), 172 | 173 | .opus: FileType( 174 | type: .opus, 175 | ext: "opus", 176 | mime: "audio/opus" 177 | ), 178 | 179 | .ogv: FileType( 180 | type: .ogv, 181 | ext: "ogv", 182 | mime: "video/ogg" 183 | ), 184 | 185 | .ogm: FileType( 186 | type: .ogm, 187 | ext: "ogm", 188 | mime: "video/ogg" 189 | ), 190 | 191 | .oga: FileType( 192 | type: .oga, 193 | ext: "oga", 194 | mime: "audio/ogg" 195 | ), 196 | 197 | .spx: FileType( 198 | type: .spx, 199 | ext: "spx", 200 | mime: "audio/ogg" 201 | ), 202 | 203 | .ogg: FileType( 204 | type: .ogg, 205 | ext: "ogg", 206 | mime: "audio/ogg" 207 | ), 208 | 209 | .ogx: FileType( 210 | type: .ogx, 211 | ext: "ogx", 212 | mime: "application/ogg" 213 | ), 214 | 215 | .heif: FileType( 216 | type: .heic, 217 | ext: "heic", 218 | mime: "image/heif" 219 | ), 220 | 221 | .heifSequence: FileType( 222 | type: .heic, 223 | ext: "heic", 224 | mime: "image/heif-sequence" 225 | ), 226 | 227 | .heic: FileType( 228 | type: .heic, 229 | ext: "heic", 230 | mime: "image/heic" 231 | ), 232 | 233 | .heicSequence: FileType( 234 | type: .heic, 235 | ext: "heic", 236 | mime: "image/heic-sequence" 237 | ), 238 | 239 | .mov: FileType( 240 | type: .mov, 241 | ext: "mov", 242 | mime: "video/quicktime" 243 | ), 244 | 245 | .m4v: FileType( 246 | type: .m4v, 247 | ext: "m4v", 248 | mime: "video/x-m4v" 249 | ), 250 | 251 | .m4p: FileType( 252 | type: .m4p, 253 | ext: "m4p", 254 | mime: "video/mp4" 255 | ), 256 | 257 | .m4b: FileType( 258 | type: .m4b, 259 | ext: "m4b", 260 | mime: "audio/mp4" 261 | ), 262 | 263 | .m4a: FileType( 264 | type: .m4a, 265 | ext: "m4a", 266 | mime: "audio/x-m4a" 267 | ), 268 | 269 | .f4v: FileType( 270 | type: .f4v, 271 | ext: "f4v", 272 | mime: "video/mp4" 273 | ), 274 | 275 | .f4p: FileType( 276 | type: .f4p, 277 | ext: "f4p", 278 | mime: "video/mp4" 279 | ), 280 | 281 | .f4a: FileType( 282 | type: .f4a, 283 | ext: "f4a", 284 | mime: "audio/mp4" 285 | ), 286 | 287 | .f4b: FileType( 288 | type: .f4b, 289 | ext: "f4b", 290 | mime: "audio/mp4" 291 | ), 292 | 293 | .cr3: FileType( 294 | type: .cr3, 295 | ext: "cr3", 296 | mime: "image/x-canon-cr3" 297 | ), 298 | 299 | .threeg2: FileType( 300 | type: .threeg2, 301 | ext: "3g2", 302 | mime: "video/3gpp2" 303 | ), 304 | 305 | .threegp: FileType( 306 | type: .threegp, 307 | ext: "3gp", 308 | mime: "video/3gpp" 309 | ), 310 | 311 | .mp4: FileType( 312 | type: .mp4, 313 | ext: "mp4", 314 | mime: "video/mp4" 315 | ), 316 | 317 | .mid: FileType( 318 | type: .mid, 319 | ext: "mid", 320 | mime: "audio/midi" 321 | ), 322 | 323 | .woff: FileType( 324 | type: .woff, 325 | ext: "woff", 326 | mime: "font/woff" 327 | ), 328 | 329 | .woff2: FileType( 330 | type: .woff2, 331 | ext: "woff2", 332 | mime: "font/woff2" 333 | ), 334 | 335 | .dsf: FileType( 336 | type: .dsf, 337 | ext: "dsf", 338 | mime: "audio/x-dsf" // Non-standart 339 | ), 340 | 341 | .lz: FileType( 342 | type: .lz, 343 | ext: "lz", 344 | mime: "application/x-lzip" 345 | ), 346 | 347 | .flac: FileType( 348 | type: .flac, 349 | ext: "flac", 350 | mime: "audio/x-flac" 351 | ), 352 | 353 | .bpg: FileType( 354 | type: .bpg, 355 | ext: "bpg", 356 | mime: "image/bpg" 357 | ), 358 | 359 | .wv: FileType( 360 | type: .wv, 361 | ext: "wv", 362 | mime: "audio/wavpack" 363 | ), 364 | 365 | .ai: FileType( 366 | type: .ai, 367 | ext: "ai", 368 | mime: "application/postscript" 369 | ), 370 | 371 | .pdf: FileType( 372 | type: .pdf, 373 | ext: "pdf", 374 | mime: "application/pdf" 375 | ), 376 | 377 | .wasm: FileType( 378 | type: .wasm, 379 | ext: "wasm", 380 | mime: "application/wasm" 381 | ), 382 | 383 | .cr2: FileType( 384 | type: .cr2, 385 | ext: "cr2", 386 | mime: "image/x-canon-cr2" 387 | ), 388 | 389 | .nef: FileType( 390 | type: .nef, 391 | ext: "nef", 392 | mime: "image/x-nikon-nef" 393 | ), 394 | 395 | .dng: FileType( 396 | type: .dng, 397 | ext: "dng", 398 | mime: "image/x-adobe-dng" 399 | ), 400 | 401 | .arw: FileType( 402 | type: .arw, 403 | ext: "arw", 404 | mime: "image/x-sony-arw" 405 | ), 406 | 407 | .tif: FileType( 408 | type: .tif, 409 | ext: "tif", 410 | mime: "image/tiff" 411 | ), 412 | 413 | .ape: FileType( 414 | type: .ape, 415 | ext: "ape", 416 | mime: "audio/ape" 417 | ), 418 | 419 | .avi: FileType( 420 | type: .avi, 421 | ext: "avi", 422 | mime: "video/vnd.avi" 423 | ), 424 | 425 | .wav: FileType( 426 | type: .wav, 427 | ext: "wav", 428 | mime: "audio/vnd.wave" 429 | ), 430 | 431 | .qcp: FileType( 432 | type: .qcp, 433 | ext: "qcp", 434 | mime: "audio/qcelp" 435 | ), 436 | 437 | .sql: FileType( 438 | type: .sql, 439 | ext: "sqlite", 440 | mime: "application/x-sqlite3" 441 | ), 442 | 443 | .nes: FileType( 444 | type: .nes, 445 | ext: "nes", 446 | mime: "application/x-nintendo-nes-rom" 447 | ), 448 | 449 | .crx: FileType( 450 | type: .crx, 451 | ext: "crx", 452 | mime: "application/x-google-chrome-extension" 453 | ), 454 | 455 | .cab: FileType( 456 | type: .cab, 457 | ext: "cab", 458 | mime: "application/vnd.ms-cab-compressed" 459 | ), 460 | 461 | .rpm: FileType( 462 | type: .rpm, 463 | ext: "rpm", 464 | mime: "application/x-rpm" 465 | ), 466 | 467 | .otf: FileType( 468 | type: .otf, 469 | ext: "otf", 470 | mime: "font/otf" 471 | ), 472 | 473 | .amr: FileType( 474 | type: .amr, 475 | ext: "amr", 476 | mime: "audio/amr" 477 | ), 478 | 479 | .rtf: FileType( 480 | type: .rtf, 481 | ext: "rtf", 482 | mime: "application/rtf" 483 | ), 484 | 485 | .flv: FileType( 486 | type: .flv, 487 | ext: "flv", 488 | mime: "video/x-flv" 489 | ), 490 | 491 | .it: FileType( 492 | type: .it, 493 | ext: "it", 494 | mime: "audio/x-it" 495 | ), 496 | 497 | .mp1s: FileType( 498 | type: .mpg, 499 | ext: "mpg", // May also be .ps, .mpeg 500 | mime: "video/MP1S" 501 | ), 502 | 503 | .mp2p: FileType( 504 | type: .mpg, 505 | ext: "mpg", // May also be .mpg, .m2p, .vob or .sub 506 | mime: "video/MP2P" 507 | ), 508 | 509 | .xz: FileType( 510 | type: .xz, 511 | ext: "xz", 512 | mime: "application/x-xz" 513 | ), 514 | 515 | .xml: FileType( 516 | type: .xml, 517 | ext: "xml", 518 | mime: "application/xml" 519 | ), 520 | 521 | .ics: FileType( 522 | type: .ics, 523 | ext: "ics", 524 | mime: "text/calendar" 525 | ), 526 | 527 | .vcf: FileType( 528 | type: .vcf, 529 | ext: "vcf", 530 | mime: "text/vcard" 531 | ), 532 | 533 | .sevenz: FileType( 534 | type: .sevenz, 535 | ext: "7z", 536 | mime: "application/x-7z-compressed" 537 | ), 538 | 539 | .rar: FileType( 540 | type: .rar, 541 | ext: "rar", 542 | mime: "application/x-rar-compressed" 543 | ), 544 | 545 | .stl: FileType( 546 | type: .stl, 547 | ext: "stl", 548 | mime: "model/stl" 549 | ), 550 | 551 | .ble: FileType( 552 | type: .ble, 553 | ext: "blend", 554 | mime: "application/x-blender" 555 | ), 556 | 557 | .deb: FileType( 558 | type: .deb, 559 | ext: "deb", 560 | mime: "application/x-deb" 561 | ), 562 | 563 | .ar: FileType( 564 | type: .ar, 565 | ext: "ar", 566 | mime: "application/x-unix-archive" 567 | ), 568 | 569 | .apng: FileType( 570 | type: .apng, 571 | ext: "apng", 572 | mime: "image/apng" 573 | ), 574 | 575 | .png: FileType( 576 | type: .png, 577 | ext: "png", 578 | mime: "image/png" 579 | ), 580 | 581 | .arr: FileType( 582 | type: .arr, 583 | ext: "arrow", 584 | mime: "application/x-apache-arrow" 585 | ), 586 | 587 | .glb: FileType( 588 | type: .glb, 589 | ext: "glb", 590 | mime: "model/gltf-binary" 591 | ), 592 | 593 | .orf: FileType( 594 | type: .orf, 595 | ext: "orf", 596 | mime: "image/x-olympus-orf" 597 | ), 598 | 599 | .xcf: FileType( 600 | type: .xcf, 601 | ext: "xcf", 602 | mime: "image/x-xcf" 603 | ), 604 | 605 | .rw2: FileType( 606 | type: .rw2, 607 | ext: "rw2", 608 | mime: "image/x-panasonic-rw2" 609 | ), 610 | 611 | .asf: FileType( 612 | type: .asf, 613 | ext: "asf", 614 | mime: "application/vnd.ms-asf" 615 | ), 616 | 617 | .ktx: FileType( 618 | type: .ktx, 619 | ext: "ktx", 620 | mime: "image/ktx" 621 | ), 622 | 623 | .mie: FileType( 624 | type: .mie, 625 | ext: "mie", 626 | mime: "application/x-mie" 627 | ), 628 | 629 | .shp: FileType( 630 | type: .shp, 631 | ext: "shp", 632 | mime: "application/x-esri-shape" 633 | ), 634 | 635 | // JPEG-2000 family 636 | .jp2: FileType( 637 | type: .jp2, 638 | ext: "jp2", 639 | mime: "image/jp2" 640 | ), 641 | 642 | .jpx: FileType( 643 | type: .jpx, 644 | ext: "jpx", 645 | mime: "image/jpx" 646 | ), 647 | 648 | .jpm: FileType( 649 | type: .jpm, 650 | ext: "jpm", 651 | mime: "image/jpm" 652 | ), 653 | 654 | .mj2: FileType( 655 | type: .mj2, 656 | ext: "mj2", 657 | mime: "image/mj2" 658 | ), 659 | 660 | .jxl: FileType( 661 | type: .jxl, 662 | ext: "jxl", 663 | mime: "image/jxl" 664 | ), 665 | 666 | .mpg: FileType( 667 | type: .mpg, 668 | ext: "mpg", 669 | mime: "video/mpeg" 670 | ), 671 | 672 | .chm: FileType( 673 | type: .chm, 674 | ext: "chm", 675 | mime: "application/vnd.ms-htmlhelp" 676 | ), 677 | 678 | .ttf: FileType( 679 | type: .ttf, 680 | ext: "ttf", 681 | mime: "font/ttf" 682 | ), 683 | 684 | .ico: FileType( 685 | type: .ico, 686 | ext: "ico", 687 | mime: "image/x-icon" 688 | ), 689 | 690 | .icns: FileType( 691 | type: .icns, 692 | ext: "icns", 693 | mime: "image/icns" 694 | ), 695 | 696 | .cur: FileType( 697 | type: .cur, 698 | ext: "cur", 699 | mime: "image/x-icon" 700 | ), 701 | 702 | .raf: FileType( 703 | type: .raf, 704 | ext: "raf", 705 | mime: "image/x-fujifilm-raf" 706 | ), 707 | 708 | .xm: FileType( 709 | type: .xm, 710 | ext: "xm", 711 | mime: "audio/x-xm" 712 | ), 713 | 714 | .voc: FileType( 715 | type: .voc, 716 | ext: "voc", 717 | mime: "audio/x-voc" 718 | ), 719 | 720 | .cfb: FileType( 721 | type: .cfb, 722 | ext: "cfb", 723 | mime: "application/x-cfb" 724 | ), 725 | 726 | .mxf: FileType( 727 | type: .mxf, 728 | ext: "mxf", 729 | mime: "application/mxf" 730 | ), 731 | 732 | .s3m: FileType( 733 | type: .s3m, 734 | ext: "s3m", 735 | mime: "audio/x-s3m" 736 | ), 737 | 738 | .mts: FileType( 739 | type: .mts, 740 | ext: "mts", 741 | mime: "video/mp2t" 742 | ), 743 | 744 | .mobi: FileType( 745 | type: .mobi, 746 | ext: "mobi", 747 | mime: "application/x-mobipocket-ebook" 748 | ), 749 | 750 | .dcm: FileType( 751 | type: .dcm, 752 | ext: "dcm", 753 | mime: "application/dicom" 754 | ), 755 | 756 | .lnk: FileType( 757 | type: .lnk, 758 | ext: "lnk", 759 | mime: "application/x.ms.shortcut" // Invented by u 760 | ), 761 | 762 | .ali: FileType( 763 | type: .ali, 764 | ext: "alias", 765 | mime: "application/x.apple.alias" // Invented by us 766 | ), 767 | 768 | .eot: FileType( 769 | type: .eot, 770 | ext: "eot", 771 | mime: "application/vnd.ms-fontobject" 772 | ), 773 | 774 | .tar: FileType( 775 | type: .tar, 776 | ext: "tar", 777 | mime: "application/x-tar" 778 | ), 779 | 780 | .aac: FileType( 781 | type: .aac, 782 | ext: "aac", 783 | mime: "audio/aac" 784 | ), 785 | 786 | .mp2: FileType( 787 | type: .mp2, 788 | ext: "mp2", 789 | mime: "audio/mpeg" 790 | ), 791 | 792 | .mp1: FileType( 793 | type: .mp1, 794 | ext: "mp1", 795 | mime: "audio/mpeg" 796 | ), 797 | 798 | .mp3: FileType( 799 | type: .mp3, 800 | ext: "mp3", 801 | mime: "audio/mpeg" 802 | ), 803 | 804 | .pgp: FileType( 805 | type: .pgp, 806 | ext: "pgp", 807 | mime: "application/pgp-encrypted" 808 | ), 809 | 810 | .lzh: FileType( 811 | type: .lzh, 812 | ext: "lzh", 813 | mime: "application/x-lzh-compressed" 814 | ), 815 | 816 | .skp: FileType( 817 | type: .skp, 818 | ext: "skp", 819 | mime: "application/vnd.sketchup.skp" 820 | ), 821 | 822 | .avif: FileType( 823 | type: .avif, 824 | ext: "avif", 825 | mime: "image/avif" 826 | ), 827 | 828 | .eps: FileType( 829 | type: .eps, 830 | ext: "eps", 831 | mime: "application/eps" 832 | ), 833 | 834 | .zst: FileType( 835 | type: .zst, 836 | ext: "zst", 837 | mime: "application/zstd" 838 | ), 839 | 840 | .indd: FileType( 841 | type: .indd, 842 | ext: "indd", 843 | mime: "application/x-indesign" 844 | ), 845 | 846 | .elf: FileType( 847 | type: .elf, 848 | ext: "elf", 849 | mime: "application/x-elf" 850 | ), 851 | 852 | .mkv: FileType( 853 | type: .mkv, 854 | ext: "mkv", 855 | mime: "video/x-matroska" 856 | ), 857 | 858 | .webm: FileType( 859 | type: .webm, 860 | ext: "webm", 861 | mime: "video/webm" 862 | ), 863 | ] 864 | } 865 | 866 | public extension FileType { 867 | static func getBytesCountFor(type: FileTypeExtension) -> Int { 868 | FileTypeMatch.all 869 | .filter { FileType.all[$0.type]?.type == type } 870 | .reduce(into: 0) { $0 = max( 871 | $0, 872 | $1.bytesCount ?? 0, 873 | $1.matchBytes?.reduce(into: 0) { $0 = max($0, $1.count) } ?? 0, 874 | $1.matchString?.reduce(into: 0) { $0 = max($0, $1.count) } ?? 0 875 | ) } 876 | } 877 | 878 | static func getBytesCountFor(types: [FileTypeExtension]) -> Int { 879 | FileTypeMatch.all 880 | .filter { types.contains(FileType.all[$0.type]!.type) } 881 | .reduce(into: 0) { $0 = max( 882 | $0, 883 | $1.bytesCount ?? 0, 884 | $1.matchBytes?.reduce(into: 0) { $0 = max($0, $1.count) } ?? 0, 885 | $1.matchString?.reduce(into: 0) { $0 = max($0, $1.count) } ?? 0 886 | ) } 887 | } 888 | 889 | static func getFor(type: FileTypeExtension) -> [FileType] { 890 | FileType.all 891 | .filter { _, value in 892 | value.type == type 893 | } 894 | .map { _, value in value } 895 | } 896 | 897 | static func getFor(data: Data) -> FileType? { 898 | for fileTypeMatch in FileTypeMatch.all { 899 | if fileTypeMatch.bytesCount != nil, fileTypeMatch.bytesCount! > data.count { 900 | continue 901 | } 902 | 903 | var isMatched: Bool = false 904 | 905 | if let matchString = fileTypeMatch.matchString { 906 | if matchString.contains(where: { data.starts(with: $0.utf8) }) { 907 | isMatched = true 908 | } else { 909 | continue 910 | } 911 | } 912 | 913 | if let matchBytes = fileTypeMatch.matchBytes { 914 | if matchBytes.contains(where: { data.starts(with: $0) }) { 915 | isMatched = true 916 | } else { 917 | continue 918 | } 919 | } 920 | 921 | if let match = fileTypeMatch.match { 922 | if match(data) { 923 | isMatched = true 924 | } else { 925 | continue 926 | } 927 | } 928 | 929 | if isMatched { 930 | return FileType.all[fileTypeMatch.type] 931 | } 932 | } 933 | 934 | return nil 935 | } 936 | } 937 | -------------------------------------------------------------------------------- /Sources/FileType/FileTypeExtension.swift: -------------------------------------------------------------------------------- 1 | public enum FileTypeExtension: CaseIterable { 2 | case aac 3 | case ac3 4 | case ai 5 | case aif 6 | case ali 7 | case amr 8 | case ape 9 | case apng 10 | case ar 11 | case arr 12 | case arw 13 | case asar 14 | case asf 15 | case avi 16 | case avif 17 | case ble 18 | case bmp 19 | case bpg 20 | case bz2 21 | case cab 22 | case cfb 23 | case chm 24 | case cr2 25 | case cr3 26 | case crx 27 | case cur 28 | case dcm 29 | case deb 30 | case dmg 31 | case dng 32 | case docx 33 | case dsf 34 | case elf 35 | case eot 36 | case eps 37 | case epub 38 | case exe 39 | case f4a 40 | case f4b 41 | case f4p 42 | case f4v 43 | case flac 44 | case flif 45 | case flv 46 | case gif 47 | case glb 48 | case gz 49 | case heic 50 | case icns 51 | case ico 52 | case ics 53 | case indd 54 | case it 55 | case jp2 56 | case jpg 57 | case jpm 58 | case jpx 59 | case jxl 60 | case jxr 61 | case ktx 62 | case lnk 63 | case lz 64 | case lzh 65 | case m4a 66 | case m4b 67 | case m4p 68 | case m4v 69 | case mid 70 | case mie 71 | case mj2 72 | case mkv 73 | case mobi 74 | case mov 75 | case mp1 76 | case mp2 77 | case mp3 78 | case mp4 79 | case mpc 80 | case mpg 81 | case mts 82 | case mxf 83 | case nef 84 | case nes 85 | case odp 86 | case ods 87 | case odt 88 | case oga 89 | case ogg 90 | case ogm 91 | case ogv 92 | case ogx 93 | case opus 94 | case orf 95 | case otf 96 | case pdf 97 | case pgp 98 | case png 99 | case pptx 100 | case ps 101 | case psd 102 | case qcp 103 | case raf 104 | case rar 105 | case rpm 106 | case rtf 107 | case rw2 108 | case s3m 109 | case sevenz 110 | case shp 111 | case skp 112 | case spx 113 | case sql 114 | case stl 115 | case swf 116 | case tar 117 | case threeg2 118 | case threegp 119 | case threemf 120 | case tif 121 | case ttf 122 | case vcf 123 | case voc 124 | case wasm 125 | case wav 126 | case webm 127 | case woff 128 | case woff2 129 | case wv 130 | case xcf 131 | case xlsx 132 | case xm 133 | case xml 134 | case xpi 135 | case xz 136 | case Z 137 | case zip 138 | case zst 139 | } 140 | -------------------------------------------------------------------------------- /Sources/FileType/FileTypeMatch.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | enum FileTypeMatchType { 4 | case aac 5 | case ac3 6 | case ai 7 | case aif 8 | case ali 9 | case amr 10 | case ape 11 | case apng 12 | case ar 13 | case arr 14 | case arw 15 | case asar 16 | case asf 17 | case avi 18 | case avif 19 | case ble 20 | case bmp 21 | case bpg 22 | case bz2 23 | case cab 24 | case cfb 25 | case chm 26 | case cr2 27 | case cr3 28 | case crx 29 | case cur 30 | case dcm 31 | case deb 32 | case dmg 33 | case dng 34 | case docx 35 | case dsf 36 | case eot 37 | case elf 38 | case eps 39 | case epub 40 | case exe 41 | case f4a 42 | case f4b 43 | case f4p 44 | case f4v 45 | case flac 46 | case flif 47 | case flv 48 | case gif 49 | case glb 50 | case gz 51 | case heif 52 | case heifSequence 53 | case heic 54 | case heicSequence 55 | case ico 56 | case ics 57 | case icns 58 | case indd 59 | case it 60 | case jp2 61 | case jpg 62 | case jpm 63 | case jpx 64 | case jxl 65 | case jxr 66 | case ktx 67 | case lnk 68 | case lz 69 | case lzh 70 | case m4a 71 | case m4b 72 | case m4p 73 | case m4v 74 | case mid 75 | case mie 76 | case mj2 77 | case mkv 78 | case mobi 79 | case mov 80 | case mp1 81 | case mp2 82 | case mp3 83 | case mp4 84 | case mpc 85 | case mpg 86 | case mp1s 87 | case mp2p 88 | case mts 89 | case mxf 90 | case nef 91 | case nes 92 | case odp 93 | case ods 94 | case odt 95 | case oga 96 | case ogg 97 | case ogm 98 | case ogv 99 | case ogx 100 | case opus 101 | case orf 102 | case otf 103 | case pdf 104 | case pgp 105 | case png 106 | case pptx 107 | case ps 108 | case psd 109 | case qcp 110 | case raf 111 | case rar 112 | case rpm 113 | case rtf 114 | case rw2 115 | case s3m 116 | case sevenz 117 | case shp 118 | case skp 119 | case spx 120 | case sql 121 | case stl 122 | case swf 123 | case tar 124 | case threeg2 125 | case threegp 126 | case threemf 127 | case tif 128 | case ttf 129 | case vcf 130 | case voc 131 | case wasm 132 | case wav 133 | case webm 134 | case wma 135 | case wmv 136 | case woff 137 | case woff2 138 | case wv 139 | case xcf 140 | case xlsx 141 | case xm 142 | case xml 143 | case xpi 144 | case xz 145 | case Z 146 | case zip 147 | case zst 148 | } 149 | 150 | struct FileTypeMatch { 151 | let type: FileTypeMatchType 152 | 153 | var bytesCount: Int? 154 | var matchString: [String]? 155 | var matchBytes: [[UInt8]]? 156 | var match: ((Data) -> Bool)? 157 | 158 | static let all: [FileTypeMatch] = [ 159 | FileTypeMatch( 160 | type: .bmp, 161 | matchBytes: [[0x42, 0x4D]] 162 | ), 163 | 164 | FileTypeMatch( 165 | type: .ac3, 166 | matchBytes: [[0x0B, 0x77]] 167 | ), 168 | 169 | FileTypeMatch( 170 | type: .dmg, 171 | matchBytes: [[0x78, 0x01]] 172 | ), 173 | 174 | FileTypeMatch( 175 | type: .exe, 176 | matchBytes: [[0x4D, 0x5A]] 177 | ), 178 | 179 | FileTypeMatch( 180 | type: .eps, 181 | bytesCount: 20, 182 | match: { matchPatterns($0, match: [[ 183 | .byte(0x25), .byte(0x21), .byte(0x50), .byte(0x53), .byte(0x2D), .byte(0x41), .byte(0x64), .byte(0x6F), 184 | .byte(0x62), .byte(0x65), .byte(0x2D), .any, .any, .any, 185 | .byte(0x20), .byte(0x45), .byte(0x50), .byte(0x53), .byte(0x46), .byte(0x2D), 186 | ]]) 187 | } 188 | ), 189 | 190 | FileTypeMatch( 191 | type: .ps, 192 | matchBytes: [[0x25, 0x21]] 193 | ), 194 | 195 | FileTypeMatch( 196 | type: .Z, 197 | matchBytes: [[0x1F, 0xA0], [0x1F, 0x9D]] 198 | ), 199 | 200 | FileTypeMatch( 201 | type: .jpg, 202 | matchBytes: [[0xFF, 0xD8, 0xFF]] 203 | ), 204 | 205 | FileTypeMatch( 206 | type: .jxr, 207 | matchBytes: [[0x49, 0x49, 0xBC]] 208 | ), 209 | 210 | FileTypeMatch( 211 | type: .gz, 212 | matchBytes: [[0x1F, 0x8B, 0x8]] 213 | ), 214 | 215 | FileTypeMatch( 216 | type: .bz2, 217 | matchBytes: [[0x42, 0x5A, 0x68]] 218 | ), 219 | 220 | FileTypeMatch( 221 | type: .mpc, 222 | matchString: ["MP+"] 223 | ), 224 | 225 | FileTypeMatch( 226 | type: .gif, 227 | matchBytes: [[0x47, 0x49, 0x46]] 228 | ), 229 | 230 | FileTypeMatch( 231 | type: .flif, 232 | matchString: ["FLIF"] 233 | ), 234 | 235 | FileTypeMatch( 236 | type: .psd, 237 | matchString: ["8BPS"] 238 | ), 239 | 240 | FileTypeMatch( 241 | type: .mpc, 242 | matchString: ["MPCK"] 243 | ), 244 | 245 | FileTypeMatch( 246 | type: .aif, 247 | matchString: ["FORM"] 248 | ), 249 | 250 | FileTypeMatch( 251 | type: .swf, 252 | matchBytes: [[0x43, 0x57, 0x53], [0x46, 0x57, 0x53]] 253 | ), 254 | 255 | FileTypeMatch( 256 | type: .icns, 257 | matchString: ["icns"] 258 | ), 259 | 260 | FileTypeMatch( 261 | type: .elf, 262 | matchBytes: [[0x7F, 0x45, 0x4C, 0x46]] 263 | ), 264 | 265 | FileTypeMatch( 266 | type: .eps, 267 | matchBytes: [[0xC5, 0xD0, 0xD3, 0xC6]] 268 | ), 269 | 270 | FileTypeMatch( 271 | type: .zst, 272 | matchBytes: [[0x28, 0xB5, 0x2F, 0xFD]] 273 | ), 274 | 275 | // Zip-based file formats 276 | FileTypeMatch( 277 | type: .xpi, 278 | matchBytes: [[0x50, 0x4B, 0x3, 0x4]], 279 | match: { matchZipHeader($0) { $0.filename == "META-INF/mozilla.rsa" }} 280 | ), 281 | 282 | FileTypeMatch( 283 | type: .docx, 284 | matchBytes: [[0x50, 0x4B, 0x3, 0x4]], 285 | match: { matchZipHeader($0) { 286 | matchMSOffice($0, type: "word") 287 | }} 288 | ), 289 | 290 | FileTypeMatch( 291 | type: .pptx, 292 | matchBytes: [[0x50, 0x4B, 0x3, 0x4]], 293 | match: { matchZipHeader($0) { 294 | matchMSOffice($0, type: "ppt") 295 | }} 296 | ), 297 | 298 | FileTypeMatch( 299 | type: .xlsx, 300 | matchBytes: [[0x50, 0x4B, 0x3, 0x4]], 301 | match: { matchZipHeader($0) { 302 | matchMSOffice($0, type: "xl", startsWith: "xl/") 303 | }} 304 | ), 305 | 306 | FileTypeMatch( 307 | type: .epub, 308 | matchBytes: [[0x50, 0x4B, 0x3, 0x4]], 309 | match: { matchZipHeader($0) { $0.mimeType == "application/epub+zip" }} 310 | ), 311 | 312 | FileTypeMatch( 313 | type: .odt, 314 | matchBytes: [[0x50, 0x4B, 0x3, 0x4]], 315 | match: { matchZipHeader($0) { $0.mimeType == "application/vnd.oasis.opendocument.text" }} 316 | ), 317 | 318 | FileTypeMatch( 319 | type: .ods, 320 | matchBytes: [[0x50, 0x4B, 0x3, 0x4]], 321 | match: { matchZipHeader($0) { $0.mimeType == "application/vnd.oasis.opendocument.spreadsheet" }} 322 | ), 323 | 324 | FileTypeMatch( 325 | type: .odp, 326 | matchBytes: [[0x50, 0x4B, 0x3, 0x4]], 327 | match: { matchZipHeader($0) { $0.mimeType == "application/vnd.oasis.opendocument.presentation" }} 328 | ), 329 | 330 | FileTypeMatch( 331 | type: .threemf, 332 | matchBytes: [[0x50, 0x4B, 0x3, 0x4]], 333 | match: { matchZipHeader($0) { $0.filename.hasPrefix("3D/") && $0.filename.hasSuffix(".model") }} 334 | ), 335 | 336 | FileTypeMatch( 337 | type: .zip, 338 | matchBytes: [ 339 | [0x50, 0x4B, 0x3, 0x4], 340 | [0x50, 0x4B, 0x3, 0x6], 341 | [0x50, 0x4B, 0x3, 0x8], 342 | 343 | [0x50, 0x4B, 0x5, 0x4], 344 | [0x50, 0x4B, 0x5, 0x6], 345 | [0x50, 0x4B, 0x5, 0x8], 346 | 347 | [0x50, 0x4B, 0x7, 0x4], 348 | [0x50, 0x4B, 0x7, 0x6], 349 | [0x50, 0x4B, 0x7, 0x8], 350 | ] 351 | ), 352 | 353 | // ogg container 354 | // Needs to be before `ogg` check 355 | FileTypeMatch( 356 | type: .opus, 357 | bytesCount: 36, 358 | matchString: ["OggS"], 359 | match: { matchPatterns($0, match: [ 360 | [ 361 | .byte(0x4F), .byte(0x70), .byte(0x75), .byte(0x73), 362 | .byte(0x48), .byte(0x65), .byte(0x61), .byte(0x64), 363 | ], 364 | ], offset: 28) } 365 | ), 366 | 367 | FileTypeMatch( 368 | type: .ogv, 369 | bytesCount: 35, 370 | matchString: ["OggS"], 371 | match: { matchPatterns($0, match: [ 372 | [ 373 | .byte(0x80), .byte(0x74), .byte(0x68), .byte(0x65), 374 | .byte(0x6F), .byte(0x72), .byte(0x61), 375 | ], 376 | ], offset: 28) } 377 | ), 378 | 379 | FileTypeMatch( 380 | type: .ogm, 381 | bytesCount: 35, 382 | matchString: ["OggS"], 383 | match: { matchPatterns($0, match: [ 384 | [ 385 | .byte(0x01), .byte(0x76), .byte(0x69), .byte(0x64), 386 | .byte(0x65), .byte(0x6F), .byte(0x00), 387 | ], 388 | ], offset: 28) } 389 | ), 390 | 391 | FileTypeMatch( 392 | type: .oga, 393 | bytesCount: 33, 394 | matchString: ["OggS"], 395 | match: { matchPatterns($0, match: [ 396 | [ 397 | .byte(0x7F), .byte(0x46), .byte(0x4C), .byte(0x41), 398 | .byte(0x43), 399 | ], 400 | ], offset: 28) } 401 | ), 402 | 403 | FileTypeMatch( 404 | type: .spx, 405 | bytesCount: 35, 406 | matchString: ["OggS"], 407 | match: { matchPatterns($0, match: [ 408 | [ 409 | .byte(0x53), .byte(0x70), .byte(0x65), .byte(0x65), 410 | .byte(0x78), .byte(0x20), .byte(0x20), 411 | ], 412 | ], offset: 28) } 413 | ), 414 | 415 | FileTypeMatch( 416 | type: .ogg, 417 | bytesCount: 35, 418 | matchString: ["OggS"], 419 | match: { matchPatterns($0, match: [ 420 | [ 421 | .byte(0x01), .byte(0x76), .byte(0x6F), .byte(0x72), 422 | .byte(0x62), .byte(0x69), .byte(0x73), 423 | ], 424 | ], offset: 28) } 425 | ), 426 | 427 | FileTypeMatch( 428 | type: .ogx, 429 | matchString: ["OggS"] 430 | ), 431 | 432 | // File Type Box Formats 433 | FileTypeMatch( 434 | type: .avif, 435 | bytesCount: 12, 436 | match: { matchPatterns($0, match: [ 437 | [ 438 | .byte(0x66), .byte(0x74), .byte(0x79), .byte(0x70), // ftyp 439 | .byte(0x61), .byte(0x76), .byte(0x69), .byte(0x66), // avif 440 | ], 441 | [ 442 | .byte(0x66), .byte(0x74), .byte(0x79), .byte(0x70), // ftyp 443 | .byte(0x61), .byte(0x76), .byte(0x69), .byte(0x73), // avis 444 | ], 445 | ], offset: 4) } 446 | ), 447 | 448 | FileTypeMatch( 449 | type: .heif, 450 | bytesCount: 12, 451 | match: { matchPatterns($0, match: [ 452 | [ 453 | .byte(0x66), .byte(0x74), .byte(0x79), .byte(0x70), // ftyp 454 | .byte(0x6D), .byte(0x69), .byte(0x66), .byte(0x31), // mif1 455 | ], 456 | ], offset: 4) } 457 | ), 458 | 459 | FileTypeMatch( 460 | type: .heifSequence, 461 | bytesCount: 12, 462 | match: { matchPatterns($0, match: [ 463 | [ 464 | .byte(0x66), .byte(0x74), .byte(0x79), .byte(0x70), // ftyp 465 | .byte(0x6D), .byte(0x73), .byte(0x66), .byte(0x31), // msf1 466 | ], 467 | ], offset: 4) } 468 | ), 469 | 470 | FileTypeMatch( 471 | type: .heic, 472 | bytesCount: 12, 473 | match: { matchPatterns($0, match: [ 474 | [ 475 | .byte(0x66), .byte(0x74), .byte(0x79), .byte(0x70), // ftyp 476 | .byte(0x68), .byte(0x65), .byte(0x69), .byte(0x63), // heic 477 | ], 478 | 479 | [ 480 | .byte(0x66), .byte(0x74), .byte(0x79), .byte(0x70), // ftyp 481 | .byte(0x68), .byte(0x65), .byte(0x69), .byte(0x78), // heix 482 | ], 483 | ], offset: 4) } 484 | ), 485 | 486 | FileTypeMatch( 487 | type: .heicSequence, 488 | bytesCount: 12, 489 | match: { matchPatterns($0, match: [ 490 | [ 491 | .byte(0x66), .byte(0x74), .byte(0x79), .byte(0x70), // ftyp 492 | .byte(0x68), .byte(0x65), .byte(0x76), .byte(0x63), // hevc 493 | ], 494 | 495 | [ 496 | .byte(0x66), .byte(0x74), .byte(0x79), .byte(0x70), // ftyp 497 | .byte(0x68), .byte(0x65), .byte(0x76), .byte(0x78), // hevx 498 | ], 499 | ], offset: 4) } 500 | ), 501 | 502 | FileTypeMatch( 503 | type: .mov, 504 | bytesCount: 10, 505 | match: { matchPatterns($0, match: [ 506 | [ 507 | .byte(0x66), .byte(0x74), .byte(0x79), .byte(0x70), // ftyp 508 | .byte(0x71), .byte(0x74), // qt 509 | ], 510 | ], offset: 4) } 511 | ), 512 | 513 | FileTypeMatch( 514 | type: .m4v, 515 | bytesCount: 12, 516 | match: { matchPatterns($0, match: [ 517 | [ 518 | .byte(0x66), .byte(0x74), .byte(0x79), .byte(0x70), // ftyp 519 | .byte(0x4D), .byte(0x34), .byte(0x56), // M4V 520 | ], 521 | 522 | [ 523 | .byte(0x66), .byte(0x74), .byte(0x79), .byte(0x70), // ftyp 524 | .byte(0x4D), .byte(0x34), .byte(0x56), .byte(0x48), // M4VH 525 | ], 526 | 527 | [ 528 | .byte(0x66), .byte(0x74), .byte(0x79), .byte(0x70), // ftyp 529 | .byte(0x4D), .byte(0x34), .byte(0x56), .byte(0x50), // M4VP 530 | ], 531 | 532 | ], offset: 4) } 533 | ), 534 | 535 | FileTypeMatch( 536 | type: .m4p, 537 | bytesCount: 11, 538 | match: { matchPatterns($0, match: [[ 539 | .byte(0x66), .byte(0x74), .byte(0x79), .byte(0x70), // ftyp 540 | .byte(0x4D), .byte(0x34), .byte(0x50), // M4P 541 | ]], offset: 4) } 542 | ), 543 | 544 | FileTypeMatch( 545 | type: .m4b, 546 | bytesCount: 11, 547 | match: { matchPatterns($0, match: [[ 548 | .byte(0x66), .byte(0x74), .byte(0x79), .byte(0x70), // ftyp 549 | .byte(0x4D), .byte(0x34), .byte(0x42), // M4B 550 | ]], offset: 4) } 551 | ), 552 | 553 | FileTypeMatch( 554 | type: .m4a, 555 | bytesCount: 11, 556 | match: { matchPatterns($0, match: [[ 557 | .byte(0x66), .byte(0x74), .byte(0x79), .byte(0x70), // ftyp 558 | .byte(0x4D), .byte(0x34), .byte(0x41), // M4A 559 | ]], offset: 4) } 560 | ), 561 | 562 | FileTypeMatch( 563 | type: .f4v, 564 | bytesCount: 11, 565 | match: { matchPatterns($0, match: [[ 566 | .byte(0x66), .byte(0x74), .byte(0x79), .byte(0x70), // ftyp 567 | .byte(0x46), .byte(0x34), .byte(0x56), // F4V 568 | ]], offset: 4) } 569 | ), 570 | 571 | FileTypeMatch( 572 | type: .f4p, 573 | bytesCount: 11, 574 | match: { matchPatterns($0, match: [[ 575 | .byte(0x66), .byte(0x74), .byte(0x79), .byte(0x70), // ftyp 576 | .byte(0x46), .byte(0x34), .byte(0x50), // F4P 577 | ]], offset: 4) } 578 | ), 579 | 580 | FileTypeMatch( 581 | type: .f4a, 582 | bytesCount: 11, 583 | match: { matchPatterns($0, match: [[ 584 | .byte(0x66), .byte(0x74), .byte(0x79), .byte(0x70), // ftyp 585 | .byte(0x46), .byte(0x34), .byte(0x41), // F4A 586 | ]], offset: 4) } 587 | ), 588 | 589 | FileTypeMatch( 590 | type: .f4b, 591 | bytesCount: 11, 592 | match: { matchPatterns($0, match: [[ 593 | .byte(0x66), .byte(0x74), .byte(0x79), .byte(0x70), // ftyp 594 | .byte(0x46), .byte(0x34), .byte(0x42), // F4B 595 | ]], offset: 4) } 596 | ), 597 | 598 | FileTypeMatch( 599 | type: .cr3, 600 | bytesCount: 11, 601 | match: { matchPatterns($0, match: [[ 602 | .byte(0x66), .byte(0x74), .byte(0x79), .byte(0x70), // ftyp 603 | .byte(0x63), .byte(0x72), .byte(0x78), // crx 604 | ]], offset: 4) } 605 | ), 606 | 607 | FileTypeMatch( 608 | type: .threeg2, 609 | bytesCount: 11, 610 | match: { matchPatterns($0, match: [[ 611 | .byte(0x66), .byte(0x74), .byte(0x79), .byte(0x70), // ftyp 612 | .byte(0x33), .byte(0x67), .byte(0x32), // 3g2 613 | ]], offset: 4) } 614 | ), 615 | 616 | FileTypeMatch( 617 | type: .threegp, 618 | bytesCount: 10, 619 | match: { matchPatterns($0, match: [[ 620 | .byte(0x66), .byte(0x74), .byte(0x79), .byte(0x70), // ftyp 621 | .byte(0x33), .byte(0x67), // 3g 622 | ]], offset: 4) } 623 | ), 624 | 625 | FileTypeMatch( 626 | type: .mp4, 627 | bytesCount: 8, 628 | match: { matchPatterns($0, match: [[ 629 | .byte(0x66), .byte(0x74), .byte(0x79), .byte(0x70), // ftyp 630 | ]], offset: 4) } 631 | ), 632 | 633 | FileTypeMatch( 634 | type: .mid, 635 | matchString: ["MThd"] 636 | ), 637 | 638 | FileTypeMatch( 639 | type: .woff, 640 | bytesCount: 12, 641 | matchString: ["wOFF"], 642 | match: { 643 | matchPatterns($0, match: [ 644 | [.byte(0x0), .byte(0x01), .byte(0x0), .byte(0x0)], 645 | [.byte(0x4F), .byte(0x54), .byte(0x54), .byte(0x4F)], 646 | ], offset: 4) 647 | } 648 | ), 649 | 650 | FileTypeMatch( 651 | type: .woff2, 652 | bytesCount: 12, 653 | matchString: ["wOF2"], 654 | match: { 655 | matchPatterns($0, match: [ 656 | [.byte(0x00), .byte(0x01), .byte(0x0), .byte(0x00)], 657 | [.byte(0x4F), .byte(0x54), .byte(0x54), .byte(0x4F)], 658 | ], offset: 4) 659 | } 660 | ), 661 | 662 | FileTypeMatch( 663 | type: .dsf, 664 | matchString: ["DSD "] 665 | ), 666 | 667 | FileTypeMatch( 668 | type: .lz, 669 | matchString: ["LZIP"] 670 | ), 671 | 672 | FileTypeMatch( 673 | type: .flac, 674 | matchString: ["fLaC"] 675 | ), 676 | 677 | FileTypeMatch( 678 | type: .bpg, 679 | matchBytes: [[0x42, 0x50, 0x47, 0xFB]] 680 | ), 681 | 682 | FileTypeMatch( 683 | type: .wv, 684 | matchString: ["wvpk"] 685 | ), 686 | 687 | FileTypeMatch( 688 | type: .ai, 689 | matchString: ["%PDF"], 690 | match: { findString($0, "AIPrivateData", ignore: 1350) } 691 | ), 692 | 693 | FileTypeMatch( 694 | type: .pdf, 695 | matchString: ["%PDF"] 696 | ), 697 | 698 | FileTypeMatch( 699 | type: .wasm, 700 | matchBytes: [[0x00, 0x61, 0x73, 0x6D]] 701 | ), 702 | 703 | // tiff, little-endian type based file formats 704 | FileTypeMatch( 705 | type: .cr2, 706 | bytesCount: 10, 707 | matchBytes: [[0x49, 0x49, 0x2A, 0x0]], 708 | match: { 709 | matchPatterns($0, match: [[.byte(0x43), .byte(0x52)]], offset: 8) 710 | } 711 | ), 712 | 713 | FileTypeMatch( 714 | type: .nef, 715 | bytesCount: 12, 716 | matchBytes: [[0x49, 0x49, 0x2A, 0x0]], 717 | match: { 718 | matchPatterns($0, match: [ 719 | [.byte(0x1C), .byte(0x0), .byte(0xFE), .byte(0x0)], 720 | [.byte(0x1F), .byte(0x0), .byte(0x0B), .byte(0x0)], 721 | ], offset: 8) 722 | } 723 | ), 724 | 725 | FileTypeMatch( 726 | type: .dng, 727 | bytesCount: 12, 728 | matchBytes: [[0x49, 0x49, 0x2A, 0x0]], 729 | match: { 730 | matchPatterns($0, match: [ 731 | [ 732 | .byte(0x08), .byte(0x0), .byte(0x0), .byte(0x0), 733 | .byte(0x2D), .byte(0x0), .byte(0xFE), .byte(0x0), 734 | ], 735 | [ 736 | .byte(0x08), .byte(0x0), .byte(0x0), .byte(0x0), 737 | .byte(0x27), .byte(0x0), .byte(0xFE), .byte(0x0), 738 | ], 739 | ], offset: 4) 740 | } 741 | ), 742 | 743 | FileTypeMatch( 744 | type: .arw, 745 | bytesCount: 24, 746 | matchBytes: [[0x49, 0x49, 0x2A, 0x0]], 747 | match: { 748 | matchPatterns($0, match: [ 749 | [ 750 | .byte(0x10), .byte(0xFB), .byte(0x86), .byte(0x01), 751 | .any, 752 | .byte(0x0), .byte(0xFE), .byte(0x00), .byte(0x04), 753 | .byte(0x0), .byte(0x01), .byte(0x00), .byte(0x00), 754 | .byte(0x0), .byte(0x01), .byte(0x00), .byte(0x00), 755 | .byte(0x0), .byte(0x03), .byte(0x01), 756 | ], 757 | [ 758 | .byte(0x08), .byte(0x00), .byte(0x00), .byte(0x00), 759 | .any, 760 | .byte(0x0), .byte(0xFE), .byte(0x00), .byte(0x04), 761 | .byte(0x0), .byte(0x01), .byte(0x00), .byte(0x00), 762 | .byte(0x0), .byte(0x01), .byte(0x00), .byte(0x00), 763 | .byte(0x0), .byte(0x03), .byte(0x01), 764 | ], 765 | ], offset: 4) 766 | } 767 | ), 768 | 769 | FileTypeMatch( 770 | type: .tif, 771 | matchBytes: [ 772 | [0x49, 0x49, 0x2A, 0x0], 773 | [0x4D, 0x4D, 0x0, 0x2A], 774 | ] 775 | ), 776 | 777 | FileTypeMatch( 778 | type: .ape, 779 | matchString: ["MAC "] 780 | ), 781 | 782 | // matroska 783 | FileTypeMatch( 784 | type: .webm, 785 | matchBytes: [[0x1A, 0x45, 0xDF, 0xA3]], 786 | match: { 787 | matchMatroskaDocType($0, "webm") 788 | } 789 | ), 790 | 791 | FileTypeMatch( 792 | type: .mkv, 793 | matchBytes: [[0x1A, 0x45, 0xDF, 0xA3]], 794 | match: { 795 | matchMatroskaDocType($0, "matr") 796 | } 797 | ), 798 | 799 | FileTypeMatch( 800 | type: .avi, 801 | bytesCount: 11, 802 | matchBytes: [[0x52, 0x49, 0x46, 0x46]], 803 | match: { 804 | matchPatterns($0, match: [ 805 | [.byte(0x41), .byte(0x56), .byte(0x49)], 806 | ], offset: 8) 807 | } 808 | ), 809 | 810 | FileTypeMatch( 811 | type: .wav, 812 | bytesCount: 12, 813 | matchBytes: [[0x52, 0x49, 0x46, 0x46]], 814 | match: { 815 | matchPatterns($0, match: [ 816 | [.byte(0x57), .byte(0x41), .byte(0x56), .byte(0x45)], 817 | ], offset: 8) 818 | } 819 | ), 820 | 821 | FileTypeMatch( 822 | type: .qcp, 823 | bytesCount: 12, 824 | matchBytes: [[0x52, 0x49, 0x46, 0x46]], 825 | match: { 826 | matchPatterns($0, match: [ 827 | [.byte(0x51), .byte(0x4C), .byte(0x43), .byte(0x4D)], 828 | ], offset: 8) 829 | } 830 | ), 831 | 832 | FileTypeMatch( 833 | type: .sql, 834 | matchString: ["SQLi"] 835 | ), 836 | 837 | FileTypeMatch( 838 | type: .nes, 839 | matchBytes: [[0x4E, 0x45, 0x53, 0x1A]] 840 | ), 841 | 842 | FileTypeMatch( 843 | type: .crx, 844 | matchString: ["Cr24"] 845 | ), 846 | 847 | FileTypeMatch( 848 | type: .cab, 849 | matchString: ["MSCF", "ISc("] 850 | ), 851 | 852 | FileTypeMatch( 853 | type: .rpm, 854 | matchBytes: [[0xED, 0xAB, 0xEE, 0xDB]] 855 | ), 856 | 857 | // -- 5-byte signatures -- 858 | 859 | FileTypeMatch( 860 | type: .otf, 861 | matchBytes: [[0x4F, 0x54, 0x54, 0x4F, 0x00]] 862 | ), 863 | 864 | FileTypeMatch( 865 | type: .amr, 866 | matchString: ["#!AMR"] 867 | ), 868 | 869 | FileTypeMatch( 870 | type: .rtf, 871 | matchString: ["{\\rtf"] 872 | ), 873 | 874 | FileTypeMatch( 875 | type: .flv, 876 | matchBytes: [[0x46, 0x4C, 0x56, 0x01]] 877 | ), 878 | 879 | FileTypeMatch( 880 | type: .it, 881 | matchString: ["IMPM"] 882 | ), 883 | 884 | FileTypeMatch( 885 | type: .lzh, 886 | bytesCount: 7, 887 | match: { 888 | matchPatterns($0, match: [ 889 | [.byte(0x2D), .byte(0x6C), .byte(0x68), .byte(0x30), .byte(0x2D)], 890 | [.byte(0x2D), .byte(0x6C), .byte(0x68), .byte(0x31), .byte(0x2D)], 891 | [.byte(0x2D), .byte(0x6C), .byte(0x68), .byte(0x32), .byte(0x2D)], 892 | [.byte(0x2D), .byte(0x6C), .byte(0x68), .byte(0x33), .byte(0x2D)], 893 | [.byte(0x2D), .byte(0x6C), .byte(0x68), .byte(0x34), .byte(0x2D)], 894 | [.byte(0x2D), .byte(0x6C), .byte(0x68), .byte(0x35), .byte(0x2D)], 895 | [.byte(0x2D), .byte(0x6C), .byte(0x68), .byte(0x36), .byte(0x2D)], 896 | [.byte(0x2D), .byte(0x6C), .byte(0x68), .byte(0x37), .byte(0x2D)], 897 | [.byte(0x2D), .byte(0x6C), .byte(0x68), .byte(0x64), .byte(0x2D)], 898 | [.byte(0x2D), .byte(0x6C), .byte(0x7A), .byte(0x73), .byte(0x2D)], 899 | [.byte(0x2D), .byte(0x6C), .byte(0x7A), .byte(0x34), .byte(0x2D)], 900 | [.byte(0x2D), .byte(0x6C), .byte(0x7A), .byte(0x35), .byte(0x2D)], 901 | ], offset: 2) 902 | } 903 | ), 904 | 905 | // MPEG-PS, MPEG-1 Part 1 906 | FileTypeMatch( 907 | type: .mpg, 908 | bytesCount: 5, 909 | matchBytes: [[0x00, 0x00, 0x01, 0xBA]], 910 | match: { 911 | matchPatterns($0, match: [[.byte(0x21)]], offset: 4, mask: [0xF1]) 912 | } 913 | ), 914 | 915 | // MPEG-PS, MPEG-2 Part 1 916 | FileTypeMatch( 917 | type: .mpg, 918 | bytesCount: 5, 919 | matchBytes: [[0x00, 0x00, 0x01, 0xBA]], 920 | match: { 921 | matchPatterns($0, match: [[.byte(0x44)]], offset: 4, mask: [0xC4]) 922 | } 923 | ), 924 | 925 | FileTypeMatch( 926 | type: .chm, 927 | matchString: ["ITSF"] 928 | ), 929 | 930 | FileTypeMatch( 931 | type: .xz, 932 | matchBytes: [[0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00]] 933 | ), 934 | 935 | FileTypeMatch( 936 | type: .xml, 937 | matchBytes: [ 938 | [0x3C, 0x3F, 0x78, 0x6D, 0x6C, 0x20], // "], 984 | match: { matchPatterns($0, match: [ 985 | [ 986 | .byte(0x64), .byte(0x65), .byte(0x62), .byte(0x69), 987 | .byte(0x61), .byte(0x6E), .byte(0x2D), .byte(0x62), 988 | .byte(0x69), .byte(0x6E), .byte(0x61), .byte(0x72), 989 | .byte(0x79), 990 | ], 991 | ], offset: 8) } 992 | ), 993 | 994 | FileTypeMatch( 995 | type: .ar, 996 | matchString: ["!"] 997 | ), 998 | 999 | FileTypeMatch( 1000 | type: .apng, 1001 | bytesCount: 32, 1002 | matchBytes: [[0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A]], 1003 | match: findAPNG 1004 | ), 1005 | 1006 | FileTypeMatch( 1007 | type: .png, 1008 | matchBytes: [[0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A]], 1009 | match: findPNG 1010 | ), 1011 | 1012 | FileTypeMatch( 1013 | type: .arr, 1014 | matchBytes: [[0x41, 0x52, 0x52, 0x4F, 0x57, 0x31, 0x00, 0x00]] 1015 | ), 1016 | 1017 | FileTypeMatch( 1018 | type: .glb, 1019 | matchBytes: [[0x67, 0x6C, 0x54, 0x46, 0x02, 0x00, 0x00, 0x00]] 1020 | ), 1021 | 1022 | FileTypeMatch( 1023 | type: .mov, 1024 | bytesCount: 8, 1025 | match: { 1026 | matchPatterns($0, match: [ 1027 | [.byte(0x66), .byte(0x72), .byte(0x65), .byte(0x65)], // `free` 1028 | [.byte(0x6D), .byte(0x64), .byte(0x61), .byte(0x74)], // `mdat` MJPEG 1029 | [.byte(0x6D), .byte(0x6F), .byte(0x6F), .byte(0x76)], // `moov` 1030 | [.byte(0x77), .byte(0x69), .byte(0x64), .byte(0x65)], // `wide` 1031 | ], offset: 4) 1032 | } 1033 | ), 1034 | 1035 | FileTypeMatch( 1036 | type: .orf, 1037 | matchBytes: [[0x49, 0x49, 0x52, 0x4F, 0x08, 0x00, 0x00, 0x00, 0x18]] 1038 | ), 1039 | 1040 | FileTypeMatch( 1041 | type: .xcf, 1042 | matchString: ["gimp xcf "] 1043 | ), 1044 | 1045 | // -- 12-byte signatures -- 1046 | 1047 | FileTypeMatch( 1048 | type: .rw2, 1049 | matchBytes: [[0x49, 0x49, 0x55, 0x00, 0x18, 0x00, 0x00, 0x00, 0x88, 0xE7, 0x74, 0xD8]] 1050 | ), 1051 | 1052 | FileTypeMatch( 1053 | type: .asf, 1054 | bytesCount: 1024, 1055 | matchBytes: [[ 1056 | 0x30, 0x26, 0xB2, 0x75, 1057 | 0x8E, 0x66, 0xCF, 0x11, 1058 | 0xA6, 0xD9, 1059 | ]], 1060 | match: { matchAsfHeader($0, [ 1061 | 0x40, 0x9E, 0x69, 0xF8, 1062 | 0x4D, 0x5B, 0xCF, 0x11, 1063 | 0xA8, 0xFD, 0x00, 0x80, 1064 | 0x5F, 0x5C, 0x44, 0x2B, 1065 | ]) } 1066 | ), 1067 | 1068 | FileTypeMatch( 1069 | type: .asf, 1070 | bytesCount: 1024, 1071 | matchBytes: [[ 1072 | 0x30, 0x26, 0xB2, 0x75, 1073 | 0x8E, 0x66, 0xCF, 0x11, 1074 | 0xA6, 0xD9, 1075 | ]], 1076 | match: { matchAsfHeader($0, [ 1077 | 0xC0, 0xEF, 0x19, 0xBC, 1078 | 0x4D, 0x5B, 0xCF, 0x11, 1079 | 0xA8, 0xFD, 0x00, 0x80, 1080 | 0x5F, 0x5C, 0x44, 0x2B, 1081 | ]) } 1082 | ), 1083 | 1084 | FileTypeMatch( 1085 | type: .asf, 1086 | matchBytes: [[ 1087 | 0x30, 0x26, 0xB2, 0x75, 1088 | 0x8E, 0x66, 0xCF, 0x11, 1089 | 0xA6, 0xD9, 1090 | ]] 1091 | ), 1092 | 1093 | FileTypeMatch( 1094 | type: .ktx, 1095 | matchBytes: [[0xAB, 0x4B, 0x54, 0x58, 0x20, 0x31, 0x31, 0xBB, 0x0D, 0x0A, 0x1A, 0x0A]] 1096 | ), 1097 | 1098 | FileTypeMatch( 1099 | type: .mie, 1100 | bytesCount: 8, 1101 | match: { 1102 | matchPatterns($0, match: [ 1103 | [.byte(0x7E), .byte(0x10), .byte(0x04), .any, 1104 | .byte(0x30), .byte(0x4D), .byte(0x49), .byte(0x45)], 1105 | [.byte(0x7E), .byte(0x18), .byte(0x04), .any, 1106 | .byte(0x30), .byte(0x4D), .byte(0x49), .byte(0x45)], 1107 | ]) 1108 | } 1109 | ), 1110 | 1111 | FileTypeMatch( 1112 | type: .shp, 1113 | bytesCount: 14, 1114 | match: { 1115 | matchPatterns($0, match: [ 1116 | [ 1117 | .byte(0x27), .byte(0x0A), .byte(0x00), .byte(0x00), 1118 | .byte(0x00), .byte(0x00), .byte(0x00), .byte(0x00), 1119 | .byte(0x00), .byte(0x00), .byte(0x00), .byte(0x00), 1120 | ], 1121 | ], offset: 2) 1122 | } 1123 | ), 1124 | 1125 | // JPEG-2000 family 1126 | FileTypeMatch( 1127 | type: .jp2, 1128 | bytesCount: 24, 1129 | match: { 1130 | matchPatterns($0, match: [ 1131 | [ 1132 | .byte(0x00), .byte(0x00), .byte(0x00), .byte(0x0C), 1133 | .byte(0x6A), .byte(0x50), .byte(0x20), .byte(0x20), 1134 | .byte(0x0D), .byte(0x0A), .byte(0x87), .byte(0x0A), 1135 | .any, .any, .any, .any, 1136 | .any, .any, .any, .any, 1137 | .byte(0x6A), .byte(0x70), .byte(0x32), .byte(0x20), 1138 | ], 1139 | ]) 1140 | } 1141 | ), 1142 | 1143 | FileTypeMatch( 1144 | type: .jpx, 1145 | bytesCount: 24, 1146 | match: { 1147 | matchPatterns($0, match: [ 1148 | [ 1149 | .byte(0x00), .byte(0x00), .byte(0x00), .byte(0x0C), 1150 | .byte(0x6A), .byte(0x50), .byte(0x20), .byte(0x20), 1151 | .byte(0x0D), .byte(0x0A), .byte(0x87), .byte(0x0A), 1152 | .any, .any, .any, .any, 1153 | .any, .any, .any, .any, 1154 | .byte(0x6A), .byte(0x70), .byte(0x78), .byte(0x20), 1155 | ], 1156 | ]) 1157 | } 1158 | ), 1159 | 1160 | FileTypeMatch( 1161 | type: .jpm, 1162 | bytesCount: 24, 1163 | match: { 1164 | matchPatterns($0, match: [ 1165 | [ 1166 | .byte(0x00), .byte(0x00), .byte(0x00), .byte(0x0C), 1167 | .byte(0x6A), .byte(0x50), .byte(0x20), .byte(0x20), 1168 | .byte(0x0D), .byte(0x0A), .byte(0x87), .byte(0x0A), 1169 | .any, .any, .any, .any, 1170 | .any, .any, .any, .any, 1171 | .byte(0x6A), .byte(0x70), .byte(0x6D), .byte(0x20), 1172 | ], 1173 | ]) 1174 | } 1175 | ), 1176 | 1177 | FileTypeMatch( 1178 | type: .mj2, 1179 | bytesCount: 24, 1180 | match: { 1181 | matchPatterns($0, match: [ 1182 | [ 1183 | .byte(0x00), .byte(0x00), .byte(0x00), .byte(0x0C), 1184 | .byte(0x6A), .byte(0x50), .byte(0x20), .byte(0x20), 1185 | .byte(0x0D), .byte(0x0A), .byte(0x87), .byte(0x0A), 1186 | .any, .any, .any, .any, 1187 | .any, .any, .any, .any, 1188 | .byte(0x6D), .byte(0x6A), .byte(0x70), .byte(0x32), 1189 | ], 1190 | ]) 1191 | } 1192 | ), 1193 | 1194 | FileTypeMatch( 1195 | type: .jxl, 1196 | bytesCount: 24, 1197 | matchBytes: [[0xFF, 0x0A], [0x00, 0x00, 0x00, 0x0C, 0x4A, 0x58, 0x4C, 0x20, 0x0D, 0x0A, 0x87, 0x0A]] 1198 | ), 1199 | 1200 | // -- Unsafe signatures -- 1201 | FileTypeMatch( 1202 | type: .mpg, 1203 | matchBytes: [[0x0, 0x0, 0x1, 0xBA], [0x0, 0x0, 0x1, 0xB3]] 1204 | ), 1205 | 1206 | FileTypeMatch( 1207 | type: .ttf, 1208 | matchBytes: [[0x00, 0x01, 0x00, 0x00, 0x00]] 1209 | ), 1210 | 1211 | FileTypeMatch( 1212 | type: .ico, 1213 | matchBytes: [[0x00, 0x00, 0x01, 0x00]] 1214 | ), 1215 | 1216 | FileTypeMatch( 1217 | type: .cur, 1218 | matchBytes: [[0x00, 0x00, 0x02, 0x00]] 1219 | ), 1220 | 1221 | FileTypeMatch( 1222 | type: .cfb, 1223 | matchBytes: [[0xD0, 0xCF, 0x11, 0xE0, 0xA1, 0xB1, 0x1A, 0xE1]] 1224 | ), 1225 | 1226 | // Increase sample size from 12 to 256. 1227 | 1228 | FileTypeMatch( 1229 | type: .asar, 1230 | matchBytes: [[0x04, 0x00, 0x00, 0x00]], 1231 | match: matchAsarHeader 1232 | ), 1233 | 1234 | // `raf` is here just to keep all the raw image detectors together. 1235 | FileTypeMatch( 1236 | type: .raf, 1237 | matchString: ["FUJIFILMCCD-RAW"] 1238 | ), 1239 | 1240 | FileTypeMatch( 1241 | type: .xm, 1242 | matchString: ["Extended Module:"] 1243 | ), 1244 | 1245 | FileTypeMatch( 1246 | type: .pgp, 1247 | matchString: ["-----BEGIN PGP MESSAGE-----"] 1248 | ), 1249 | 1250 | FileTypeMatch( 1251 | type: .voc, 1252 | matchString: ["Creative Voice File"] 1253 | ), 1254 | 1255 | FileTypeMatch( 1256 | type: .indd, 1257 | matchBytes: [[0x06, 0x06, 0xED, 0xF5, 0xD8, 0x1D, 0x46, 0xE5, 0xBD, 0x31, 0xEF, 0xE7, 0xFE, 0x74, 0xB7, 0x1D]] 1258 | ), 1259 | 1260 | FileTypeMatch( 1261 | type: .mxf, 1262 | matchBytes: [[0x06, 0x0E, 0x2B, 0x34, 0x02, 0x05, 0x01, 0x01, 0x0D, 0x01, 0x02, 0x01, 0x01, 0x02]] 1263 | ), 1264 | 1265 | FileTypeMatch( 1266 | type: .s3m, 1267 | bytesCount: 44 + 4, 1268 | match: { matchPatterns($0, match: [ 1269 | [.byte(0x53), .byte(0x43), .byte(0x52), .byte(0x4D)], 1270 | ], offset: 44) } 1271 | ), 1272 | 1273 | FileTypeMatch( 1274 | type: .mts, 1275 | bytesCount: 197, 1276 | match: { 1277 | // Raw MPEG-2 transport stream (188-byte packets) 1278 | (matchPatterns($0, match: [[.byte(0x47)]]) && 1279 | matchPatterns($0, match: [[.byte(0x47)]], offset: 188)) 1280 | || 1281 | // Blu-ray Disc Audio-Video (BDAV) MPEG-2 transport stream has 4-byte TP_extra_header before each 188-byte packet 1282 | (matchPatterns($0, match: [[.byte(0x47)]], offset: 4) && 1283 | matchPatterns($0, match: [[.byte(0x47)]], offset: 196)) 1284 | } 1285 | ), 1286 | 1287 | FileTypeMatch( 1288 | type: .mobi, 1289 | bytesCount: 60 + 8, 1290 | match: { matchPatterns($0, match: [ 1291 | [ 1292 | .byte(0x42), .byte(0x4F), .byte(0x4F), .byte(0x4B), 1293 | .byte(0x4D), .byte(0x4F), .byte(0x42), .byte(0x49), 1294 | ], 1295 | ], offset: 60) } 1296 | ), 1297 | 1298 | FileTypeMatch( 1299 | type: .dcm, 1300 | bytesCount: 128 + 4, 1301 | match: { matchPatterns($0, match: [ 1302 | [.byte(0x44), .byte(0x49), .byte(0x43), .byte(0x4D)], 1303 | ], offset: 128) } 1304 | ), 1305 | 1306 | FileTypeMatch( 1307 | type: .lnk, 1308 | matchBytes: [[0x4C, 0x00, 0x00, 0x00, 0x01, 0x14, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46]] 1309 | ), 1310 | 1311 | FileTypeMatch( 1312 | type: .ali, 1313 | matchBytes: [[0x62, 0x6F, 0x6F, 0x6B, 0x00, 0x00, 0x00, 0x00, 0x6D, 0x61, 0x72, 0x6B, 0x00, 0x00, 0x00, 0x00]] 1314 | ), 1315 | 1316 | FileTypeMatch( 1317 | type: .eot, 1318 | bytesCount: 36, 1319 | match: { 1320 | matchPatterns($0, match: [[.byte(0x4C), .byte(0x50)]], offset: 34) && 1321 | ( 1322 | matchPatterns($0, match: [[.byte(0x00), .byte(0x00), .byte(0x01)]], offset: 8) || 1323 | matchPatterns($0, match: [[.byte(0x01), .byte(0x00), .byte(0x02)]], offset: 8) || 1324 | matchPatterns($0, match: [[.byte(0x02), .byte(0x00), .byte(0x02)]], offset: 8) 1325 | ) 1326 | } 1327 | ), 1328 | 1329 | // Sample size 512 1330 | 1331 | FileTypeMatch( 1332 | type: .tar, 1333 | bytesCount: 512, 1334 | match: { tarHeaderChecksumMatches($0) } 1335 | ), 1336 | 1337 | FileTypeMatch( 1338 | type: .skp, 1339 | matchBytes: [[ 1340 | 0xFF, 0xFE, 0xFF, 0x0E, 0x53, 0x00, 0x6B, 0x00, 1341 | 0x65, 0x00, 0x74, 0x00, 0x63, 0x00, 0x68, 0x00, 1342 | 0x55, 0x00, 0x70, 0x00, 0x20, 0x00, 0x4D, 0x00, 1343 | 0x6F, 0x00, 0x64, 0x00, 0x65, 0x00, 0x6C, 0x00, 1344 | ]] 1345 | ), 1346 | 1347 | FileTypeMatch( 1348 | type: .aac, 1349 | bytesCount: 18, 1350 | match: { matchMPEGHeader($0, match: 0x10, mask: 0x16) } 1351 | ), 1352 | 1353 | FileTypeMatch( 1354 | type: .mp3, 1355 | bytesCount: 18, 1356 | match: { matchMPEGHeader($0, match: 0x02, mask: 0x06) } 1357 | ), 1358 | 1359 | FileTypeMatch( 1360 | type: .mp2, 1361 | bytesCount: 18, 1362 | match: { matchMPEGHeader($0, match: 0x04, mask: 0x06) } 1363 | ), 1364 | 1365 | FileTypeMatch( 1366 | type: .mp1, 1367 | bytesCount: 18, 1368 | match: { matchMPEGHeader($0, match: 0x06, mask: 0x06) } 1369 | ), 1370 | 1371 | FileTypeMatch( 1372 | type: .mp3, 1373 | matchString: ["ID3"] 1374 | ), 1375 | ] 1376 | } 1377 | -------------------------------------------------------------------------------- /Sources/FileType/asar.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func matchAsarHeader(_ data: Data) -> Bool { 4 | // Asar contains JSON header at offset 16. The root key of the JSON should be "files". 5 | guard data.count >= 16 else { return false } 6 | let jsonSize = data.getInt32LE(offset: 12) 7 | guard data.count >= jsonSize + 16 else { return false } 8 | let jsonObject = try? JSONSerialization.jsonObject(with: data[16 ..< jsonSize + 16], options: []) 9 | return (jsonObject as? [String: Any])?["files"] != nil 10 | } 11 | -------------------------------------------------------------------------------- /Sources/FileType/asf.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func matchAsfHeader(_ data: Data, _ match: [UInt8]) -> Bool { 4 | var position = 30 5 | 6 | while position + 24 < data.count { 7 | let id = data[position ..< position + 16] 8 | let size = data.getInt64LE(offset: position + 16) 9 | var payloadSize = size - 24 10 | 11 | position += 24 12 | 13 | // Sync on Stream-Properties-Object (B7DC0791-A9B7-11CF-8EE6-00C00C205365) 14 | if id.starts(with: [0x91, 0x07, 0xDC, 0xB7, 0xB7, 0xA9, 0xCF, 0x11, 0x8E, 0xE6, 0x00, 0xC0, 0x0C, 0x20, 0x53, 0x65]) { 15 | let typeId = data[position ..< position + 16] 16 | payloadSize -= typeId.count 17 | 18 | if typeId.starts(with: match) { 19 | return true 20 | } else { 21 | break 22 | } 23 | } 24 | 25 | position += payloadSize 26 | } 27 | 28 | return false 29 | } 30 | -------------------------------------------------------------------------------- /Sources/FileType/mkv.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func matchMatroskaDocType(_ data: Data, _ type: String) -> Bool { 4 | guard let headerRange = data.firstRange(of: [0x42, 0x82], in: 3..<4096) else { 5 | return false 6 | } 7 | 8 | let start = headerRange.upperBound + 1; 9 | let end = headerRange.upperBound + 5; 10 | let docType = data.getString(from: start ..< end) 11 | 12 | return docType == type 13 | } 14 | -------------------------------------------------------------------------------- /Sources/FileType/mpeg.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func matchMPEGHeader(_ data: Data, match: UInt8, mask: UInt8) -> Bool { 4 | for i in 0 ... 1 { 5 | if (data[i] & 0xFF) == 0xFF, (data[i + 1] & 0xE0) == 0xE0 { 6 | return data[i + 1] & mask == match 7 | } 8 | } 9 | 10 | return false 11 | } 12 | -------------------------------------------------------------------------------- /Sources/FileType/png.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | private enum PNG { 4 | case Corrupt 5 | case PNG 6 | case APNG 7 | } 8 | 9 | private func checkPNG(_ data: Data) -> PNG { 10 | // Offset calculated as follows: 11 | // - 8 bytes: PNG signature 12 | // - 4 (length) + 4 (chunk type) + 13 (chunk data) + 4 (CRC): IHDR chunk 13 | var position = 8 // ignore PNG signature 14 | 15 | repeat { 16 | let length = data.getInt32BE(offset: position) 17 | let type = data.getString(from: (position + 4) ..< (position + 8))! 18 | 19 | if length < 0 { 20 | return .Corrupt 21 | } 22 | 23 | switch type { 24 | case "acTL": 25 | return .APNG 26 | 27 | case "IDAT": 28 | return .PNG 29 | 30 | default: 31 | position += 8 + length + 4 // Ignore chunk-data + CRC 32 | } 33 | 34 | } while position < data.count 35 | 36 | return .PNG 37 | } 38 | 39 | func findAPNG(_ data: Data) -> Bool { 40 | let png = checkPNG(data) 41 | return png == .APNG 42 | } 43 | 44 | func findPNG(_ data: Data) -> Bool { 45 | let png = checkPNG(data) 46 | return png == .PNG 47 | } 48 | -------------------------------------------------------------------------------- /Sources/FileType/tar.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func tarHeaderChecksumMatches(_ data: Data) -> Bool { 4 | if data.count < 512 { // `tar` header size, cannot compute checksum without it 5 | return false 6 | } 7 | 8 | guard let readSum = data.getIntByteString(from: 148 ..< 154) else { 9 | return false 10 | } 11 | 12 | let MASK_8TH_BIT = 0x80 13 | var sum = 256 // Intitalize sum, with 256 as sum of 8 spaces in checksum field 14 | var signedBitSum = 0 // Initialize signed bit sum 15 | 16 | for i in [0 ..< 148, 156 ..< 512].joined() { // Skip checksum field 17 | let byte = Int(data[i]) 18 | sum += byte 19 | signedBitSum += byte & MASK_8TH_BIT // Add signed bit to signed bit sum 20 | } 21 | 22 | // Some implementations compute checksum incorrectly using signed bytes 23 | return ( 24 | readSum == sum || // Checksum in header equals the sum we calculated 25 | readSum == (sum - (signedBitSum << 1)) // Checksum in header equals sum we calculated plus signed-to-unsigned delta 26 | ) 27 | } 28 | -------------------------------------------------------------------------------- /Sources/FileType/util.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | enum MatchPattern { 4 | case byte(UInt8) 5 | case any 6 | } 7 | 8 | func matchPatterns(_ data: Data, match: [[MatchPattern]], offset: Int = 0, mask: [UInt8]? = nil) -> Bool { 9 | for m in match { 10 | var matched = true 11 | 12 | loop: for (index, pattern) in m.enumerated() { 13 | switch pattern { 14 | case let .byte(byte): 15 | if mask != nil { 16 | if (data[offset + index] & mask![index]) != byte { 17 | matched = false 18 | break loop 19 | } 20 | } else if data[offset + index] != byte { 21 | matched = false 22 | break loop 23 | } 24 | 25 | case .any: 26 | continue 27 | } 28 | } 29 | 30 | if matched { 31 | return true 32 | } 33 | } 34 | 35 | return false 36 | } 37 | 38 | func findString(_ data: Data, _ string: String, ignore: Int? = nil) -> Bool { 39 | let minRange = min(data.count, ignore ?? data.count) 40 | let pattern = string.data(using: .utf8)! 41 | return data.range(of: pattern, in: minRange ..< data.count) != nil 42 | } 43 | -------------------------------------------------------------------------------- /Sources/FileType/zip+office.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | struct ZipHeader { 4 | let filename: String 5 | var mimeType: String? 6 | } 7 | 8 | func matchZipHeader(_ data: Data, _ match: (ZipHeader) -> Bool) -> Bool { 9 | var position = 0 10 | while position + 30 < data.count { 11 | let compressedSize = data.getInt32LE(offset: position + 18) 12 | let uncompressedSize = data.getInt32LE(offset: position + 22) 13 | let filenameLength = data.getInt16LE(offset: position + 26) 14 | guard let filename = data.getString(from: position + 30 ..< position + 30 + filenameLength) else { 15 | return false 16 | } 17 | 18 | var zipHeader = ZipHeader( 19 | filename: filename 20 | ) 21 | 22 | let extraFieldLength = data.getInt16LE(offset: position + 28) 23 | position += 30 + filenameLength + extraFieldLength 24 | 25 | if zipHeader.filename == "mimetype", compressedSize == uncompressedSize { 26 | zipHeader.mimeType = data.getString(from: position ..< position + compressedSize)?.trimmingCharacters(in: .whitespacesAndNewlines) 27 | } 28 | 29 | if match(zipHeader) { 30 | return true 31 | } 32 | 33 | // Try to find next header manually when current one is corrupted 34 | if compressedSize == 0 { 35 | var hasNextHeader = false 36 | while position + 30 < data.count, !hasNextHeader { 37 | if data[position] == 0x50, data[position + 1] == 0x4B, data[position + 2] == 0x03, data[position + 3] == 0x04 { 38 | hasNextHeader = true 39 | } else { 40 | position += 1 41 | } 42 | } 43 | } else { 44 | position += compressedSize 45 | } 46 | } 47 | 48 | return false 49 | } 50 | 51 | func matchMSOffice(_ header: ZipHeader, type: String, startsWith: String? = nil) -> Bool { 52 | guard header.filename.count > 4 else { 53 | return false 54 | } 55 | 56 | if startsWith != nil && header.filename.starts(with: startsWith!) { 57 | return true 58 | } 59 | 60 | guard header.filename.hasSuffix(".rels") || header.filename.hasSuffix(".xml") else { 61 | return false 62 | } 63 | 64 | return header.filename.split(separator: "/")[0] == type 65 | } 66 | -------------------------------------------------------------------------------- /Tests/FileTypeTests/FileTypeTests.swift: -------------------------------------------------------------------------------- 1 | @testable import FileType 2 | import XCTest 3 | 4 | private let packageRootPath = URL(fileURLWithPath: #file) 5 | .pathComponents 6 | .prefix(while: { $0 != "Tests" }) 7 | .joined(separator: "/") 8 | .dropFirst() 9 | 10 | private let fixturesPath = packageRootPath + "/Tests/Fixtures" 11 | 12 | final class FileTypeTests: XCTestCase { 13 | func testFileType(_ fixtureName: String, type: FileTypeExtension) { 14 | let absolutePath = "\(fixturesPath)/\(fixtureName)" 15 | let url = URL(fileURLWithPath: absolutePath, isDirectory: false) 16 | 17 | guard let data = try? Data(contentsOf: url, options: .mappedIfSafe) else { 18 | print("⚠️ missing \(fixtureName). Look for a specific test function.") 19 | return 20 | } 21 | 22 | let fileType = FileType.getFor(data: data)?.type 23 | XCTAssertEqual(fileType, type) 24 | if fileType != nil { 25 | print("✅ passes: \(fileType!)") 26 | } else { 27 | print("❌ fails: \(fixtureName)") 28 | } 29 | } 30 | 31 | func testAll() { 32 | for fileTypeExtension in FileTypeExtension.allCases { 33 | for fileType in FileType.getFor(type: fileTypeExtension) { 34 | testFileType("fixture.\(fileType.ext)", type: fileType.type) 35 | } 36 | } 37 | } 38 | 39 | func testTAR() { 40 | testFileType("fixture-v7.tar", type: .tar) 41 | testFileType("fixture-spaces.tar", type: .tar) 42 | testFileType("fixture.tar.Z", type: .Z) 43 | testFileType("fixture.tar.gz", type: .gz) 44 | testFileType("fixture.tar.lz", type: .lz) 45 | testFileType("fixture.tar.xz", type: .xz) 46 | } 47 | 48 | func testMPC() { 49 | testFileType("fixture-sv7.mpc", type: .mpc) 50 | testFileType("fixture-sv8.mpc", type: .mpc) 51 | } 52 | 53 | func testTIFF() { 54 | testFileType("fixture-big-endian.tif", type: .tif) 55 | } 56 | 57 | func testAPE() { 58 | testFileType("fixture-monkeysaudio.ape", type: .ape) 59 | } 60 | 61 | func testMIE() { 62 | testFileType("fixture-big-endian.mie", type: .mie) 63 | testFileType("fixture-little-endian.mie", type: .mie) 64 | } 65 | 66 | func testNEF() { 67 | testFileType("fixture2.nef", type: .nef) 68 | testFileType("fixture3.nef", type: .nef) 69 | testFileType("fixture4.nef", type: .nef) 70 | } 71 | 72 | func testDNG() { 73 | testFileType("fixture2.dng", type: .dng) 74 | } 75 | 76 | func testARW() { 77 | testFileType("fixture2.arw", type: .arw) 78 | testFileType("fixture3.arw", type: .arw) 79 | testFileType("fixture4.arw", type: .arw) 80 | testFileType("fixture5.arw", type: .arw) 81 | } 82 | 83 | func testOGX() { 84 | testFileType("fixture-unknown-ogg.ogx", type: .ogx) 85 | } 86 | 87 | func testWOFFOTTO() { 88 | testFileType("fixture-otto.woff", type: .woff) 89 | testFileType("fixture-otto.woff2", type: .woff2) 90 | } 91 | 92 | func testMOV() { 93 | testFileType("fixture-mjpeg.mov", type: .mov) 94 | testFileType("fixture-moov.mov", type: .mov) 95 | } 96 | 97 | func testFTYP() { 98 | testFileType("fixture-yuv420-8bit.avif", type: .avif) 99 | testFileType("fixture-sequence.avif", type: .avif) 100 | testFileType("fixture-mif1.heic", type: .heic) 101 | testFileType("fixture-msf1.heic", type: .heic) 102 | testFileType("fixture-heic.heic", type: .heic) 103 | testFileType("fixture2.3gp", type: .threegp) 104 | testFileType("fixture-imovie.mp4", type: .mp4) 105 | testFileType("fixture-isom.mp4", type: .mp4) 106 | testFileType("fixture-isomv2.mp4", type: .mp4) 107 | testFileType("fixture-mp4v2.mp4", type: .mp4) 108 | testFileType("fixture-dash.mp4", type: .mp4) 109 | } 110 | 111 | func testMPEG() { 112 | testFileType("fixture2.mpg", type: .mpg) 113 | testFileType("fixture.ps.mpg", type: .mpg) 114 | testFileType("fixture.sub.mpg", type: .mpg) 115 | } 116 | 117 | func testPNG() { 118 | testFileType("fixture-itxt.png", type: .png) 119 | } 120 | 121 | func testEOT() { 122 | testFileType("fixture-0x20001.eot", type: .eot) 123 | } 124 | 125 | func testMPEGAudio() { 126 | testFileType("fixture-adts-mpeg2.aac", type: .aac) 127 | testFileType("fixture-adts-mpeg4.aac", type: .aac) 128 | testFileType("fixture-adts-mpeg4-2.aac", type: .aac) 129 | // testFileType("fixture-id3v2.aac", type: .aac) 130 | 131 | testFileType("fixture-mp2l3.mp3", type: .mp3) 132 | testFileType("fixture-ffe3.mp3", type: .mp3) 133 | 134 | testFileType("fixture-mpa.mp2", type: .mp2) 135 | } 136 | 137 | func testOffice() { 138 | testFileType("fixture-office365.docx", type: .docx) 139 | testFileType("fixture-office365.pptx", type: .pptx) 140 | testFileType("fixture-office365.xlsx", type: .xlsx) 141 | 142 | testFileType("fixture2.docx", type: .docx) 143 | testFileType("fixture2.pptx", type: .pptx) 144 | testFileType("fixture2.xlsx", type: .xlsx) 145 | } 146 | 147 | func testEPS() { 148 | testFileType("fixture2.eps", type: .eps) 149 | } 150 | 151 | func testXML() { 152 | testFileType("fixture-utf8-bom.xml", type: .xml) 153 | testFileType("fixture-utf16-be-bom.xml", type: .xml) 154 | testFileType("fixture-utf16-le-bom.xml", type: .xml) 155 | } 156 | 157 | func testMTS() { 158 | testFileType("fixture-raw.mts", type: .mts) 159 | testFileType("fixture-bdav.mts", type: .mts) 160 | } 161 | 162 | func testASF() { 163 | testFileType("fixture.wma.asf", type: .asf) 164 | testFileType("fixture.wmv.asf", type: .asf) 165 | } 166 | 167 | func testJXL() { 168 | testFileType("fixture2.jxl", type: .jxl) 169 | } 170 | 171 | func testCFB() { 172 | testFileType("fixture.msi.cfb", type: .cfb) 173 | testFileType("fixture.xls.cfb", type: .cfb) 174 | testFileType("fixture.doc.cfb", type: .cfb) 175 | testFileType("fixture.ppt.cfb", type: .cfb) 176 | testFileType("fixture-2.doc.cfb", type: .cfb) 177 | } 178 | 179 | func testMatroska() { 180 | testFileType("fixture2.mkv", type: .mkv) 181 | testFileType("fixture-corrupt.mkv", type: .mkv) 182 | testFileType("fixture-null.webm", type: .webm) 183 | } 184 | 185 | func testPDF() { 186 | testFileType("fixture-without-pdf-compatibility.ai", type: .ai) 187 | testFileType("fixture-adobe-illustrator.pdf", type: .pdf) 188 | testFileType("fixture-smallest.pdf", type: .pdf) 189 | testFileType("fixture-fast-web.pdf", type: .pdf) 190 | testFileType("fixture-printed.pdf", type: .pdf) 191 | } 192 | 193 | func testEPUB() { 194 | testFileType("fixture-crlf.epub", type: .epub) 195 | } 196 | 197 | func testBytesCountForType() { 198 | XCTAssertEqual(FileType.getBytesCountFor(type: .ac3), 2) 199 | XCTAssertEqual(FileType.getBytesCountFor(type: .zip), 4) 200 | XCTAssertEqual(FileType.getBytesCountFor(type: .cab), 4) 201 | } 202 | 203 | func testBytesCountForTypes() { 204 | XCTAssertEqual(FileType.getBytesCountFor(types: [.ac3, .zip, .cab]), 4) 205 | } 206 | 207 | static var allTests = [ 208 | ("testAll", testAll), 209 | ("testTAR", testTAR), 210 | ("testMPC", testMPC), 211 | ("testTIFF", testTIFF), 212 | ("testAPE", testAPE), 213 | ("testMIE", testMIE), 214 | ("testNEF", testNEF), 215 | ("testDNG", testDNG), 216 | ("testARW", testARW), 217 | ("testOGX", testOGX), 218 | ("testWOFFOTTO", testWOFFOTTO), 219 | ("testMOV", testMOV), 220 | ("testFTYP", testFTYP), 221 | ("testMPEG", testMPEG), 222 | ("testPNG", testPNG), 223 | ("testEOT", testEOT), 224 | ("testMPEGAudio", testMPEGAudio), 225 | ("testEPS", testEPS), 226 | ("testXML", testXML), 227 | ("testMTS", testMTS), 228 | ("testASF", testASF), 229 | ("testJXL", testJXL), 230 | ("testCFB", testCFB), 231 | ("testMatroska", testMatroska), 232 | ("testPDF", testPDF), 233 | ("testEPUB", testEPUB), 234 | 235 | ("testBytesCountForType", testBytesCountForType), 236 | ("testBytesCountForTypes", testBytesCountForTypes), 237 | ] 238 | } 239 | -------------------------------------------------------------------------------- /Tests/FileTypeTests/XCTestManifests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | 3 | #if !canImport(ObjectiveC) 4 | public func allTests() -> [XCTestCaseEntry] { 5 | [ 6 | testCase(FileTypeTests.allTests), 7 | ] 8 | } 9 | #endif 10 | -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-0x20001.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture-0x20001.eot -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-2.doc.cfb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture-2.doc.cfb -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-adobe-illustrator.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture-adobe-illustrator.pdf -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-adts-mpeg2.aac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture-adts-mpeg2.aac -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-adts-mpeg4-2.aac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture-adts-mpeg4-2.aac -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-adts-mpeg4.aac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture-adts-mpeg4.aac -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-babys-songbook.m4b.m4a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture-babys-songbook.m4b.m4a -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-bdav.mts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture-bdav.mts -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-big-endian.mie: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture-big-endian.mie -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-big-endian.pcap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture-big-endian.pcap -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-big-endian.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture-big-endian.tif -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-corrupt.mkv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture-corrupt.mkv -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-corrupt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture-corrupt.png -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-crlf.epub: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture-crlf.epub -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-dash.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture-dash.mp4 -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-doc.msi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture-doc.msi -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-fast-web.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture-fast-web.pdf -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-ffe3.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture-ffe3.mp3 -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-heic.heic: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture-heic.heic -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-id3v2.aac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture-id3v2.aac -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-id3v2.flac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture-id3v2.flac -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-imovie.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture-imovie.mp4 -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-isom.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture-isom.mp4 -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-isomv2.mp4: -------------------------------------------------------------------------------- 1 | ftypmp42 -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-itxt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture-itxt.png -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-little-endian.mie: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture-little-endian.mie -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-little-endian.pcap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture-little-endian.pcap -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-little-endian.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture-little-endian.tif -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-mif1.heic: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture-mif1.heic -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-mjpeg.mov: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture-mjpeg.mov -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-monkeysaudio.ape: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture-monkeysaudio.ape -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-moov.mov: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture-moov.mov -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-mp2l3.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture-mp2l3.mp3 -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-mp4v2.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture-mp4v2.mp4 -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-mpa.mp2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture-mpa.mp2 -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-msf1.heic: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture-msf1.heic -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-null.webm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture-null.webm -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-office365.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture-office365.docx -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-office365.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture-office365.pptx -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-office365.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture-office365.xlsx -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-otto.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture-otto.woff -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-otto.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture-otto.woff2 -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-ppt.msi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture-ppt.msi -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-printed.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture-printed.pdf -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-raw.mts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture-raw.mts -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-sequence.avif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture-sequence.avif -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-smallest.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture-smallest.pdf -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-spaces.tar: -------------------------------------------------------------------------------- 1 | proc_module.xml100600 0 0 140433073 13706574161 12410 0ustar00rootroot -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-sv7.mpc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture-sv7.mpc -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-sv8.mpc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture-sv8.mpc -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-unknown-ogg.ogx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture-unknown-ogg.ogx -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-utf16-be-bom.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture-utf16-be-bom.xml -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-utf16-le-bom.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture-utf16-le-bom.xml -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-utf8-bom.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | UTF-8 with BOM 4 | 5 | -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-v7.tar: -------------------------------------------------------------------------------- 1 | test0000644000175000017500000000000013454610422006670 00000000000000 -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-without-pdf-compatibility.ai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture-without-pdf-compatibility.ai -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-xls.msi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture-xls.msi -------------------------------------------------------------------------------- /Tests/Fixtures/fixture-yuv420-8bit.avif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture-yuv420-8bit.avif -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.3g2: -------------------------------------------------------------------------------- 1 | ftyp3g2a -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.3gp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.3gp -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.3mf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.3mf -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.7z: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.7z -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.ac3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.ac3 -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.ai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.ai -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.aif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.aif -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.alias: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.alias -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.amr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.amr -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.apng: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.apng -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.ar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.ar -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.arrow: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.arrow -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.arw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.arw -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.asar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.asar -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.asf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.asf -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.avi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.avi -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.blend: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.blend -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.bmp -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.bpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.bpg -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.bz2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.bz2 -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.cab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.cab -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.chm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.chm -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.cr2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.cr2 -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.cr3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.cr3 -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.crx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.crx -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.cur: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.cur -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.dcm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.dcm -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.deb -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.dmg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.dmg -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.dng: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.dng -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.doc.cfb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.doc.cfb -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.docx -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.dsf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.dsf -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.elf -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.eot -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.eps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.eps -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.epub: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.epub -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.exe -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.f4a: -------------------------------------------------------------------------------- 1 | ftypF4A -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.f4b: -------------------------------------------------------------------------------- 1 | ftypF4B -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.f4p: -------------------------------------------------------------------------------- 1 | ftypF4P -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.f4v: -------------------------------------------------------------------------------- 1 | ftypF4V -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.flac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.flac -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.flif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.flif -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.flv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.flv -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.gif -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.glb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.glb -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.icns -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.ico -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.ics: -------------------------------------------------------------------------------- 1 | BEGIN:VCALENDAR 2 | VERSION:2.0 3 | PRODID:-//hacksw/handcal//NONSGML v1.0//EN 4 | BEGIN:VEVENT 5 | UID:19970610T172345Z-AF23B2@example.com 6 | DTSTAMP:19970610T172345Z 7 | DTSTART:19970714T170000Z 8 | DTEND:19970715T040000Z 9 | SUMMARY:Bastille Day Party 10 | END:VEVENT 11 | END:VCALENDAR -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.indd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.indd -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.it: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.it -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.jp2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.jp2 -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.jpg -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.jpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.jpm -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.jpx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.jpx -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.jxl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.jxl -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.jxr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.jxr -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.ktx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.ktx -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.lnk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.lnk -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.lzh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.lzh -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.m4a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.m4a -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.m4b: -------------------------------------------------------------------------------- 1 | ftypM4B -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.m4p: -------------------------------------------------------------------------------- 1 | ftypM4P -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.m4v: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.m4v -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.mid: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.mid -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.mj2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.mj2 -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.mkv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.mkv -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.mobi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.mobi -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.mov: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.mov -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.mp1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.mp1 -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.mp2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.mp2 -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.mp3 -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.mp4 -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.mpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.mpg -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.msi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.msi -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.msi.cfb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.msi.cfb -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.mts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.mts -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.mxf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.mxf -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.nef: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.nef -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.nes: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.nes -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.odp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.odp -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.ods: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.ods -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.odt -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.oga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.oga -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.ogg -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.ogm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.ogm -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.ogv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.ogv -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.opus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.opus -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.orf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.orf -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.otf -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.pdf -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.pgp: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP MESSAGE----- 2 | Version: OpenPGP.js v3.0.9 3 | Comment: https://openpgpjs.org 4 | 5 | wcBMA5C5XtMJioU5AQf/VlCbKDYaUD2UaAVVM4jJqktfYkNjxfGAzzJps+0e 6 | mfkkG4Ax5GJWHC0q5I3PKXlqSESpqooARa5bYZ1wt5iqEYPbUkt1csbsnXlZ 7 | X1EHwZb9YYmQBEJSjOyA49jwpeetaEt//VvIlFPHp4a7QnYePSa3gH1DsKkM 8 | NG/cZjZoh/ik5yAPD56w1/Ym+RP0y11lwpWxbpfq0iyu5RbUekD9cgXAnCvP 9 | G29Sqt8H3C299v2dbp3utRSf+bS/ERra6XVipWjjxfkD2tgrruFIERSAGQX1 10 | FPvS6ztH0301hUEXeA7cA4OuGK5sgbBeiRoSHE/DdbTeLiRIxbW01rqIXxzz 11 | ItJRAby+866YRBJnl/vvauszUFNz9JpV2ZS5c+weELrkPBlUuaV0CieLkwIn 12 | T318njOQ+cnW1cpxWPaiK/qSCBaIc6sOiVhLL4wRePu2FRe47mC4 13 | =Gp87 14 | -----END PGP MESSAGE----- 15 | -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.png -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.ppt.cfb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.ppt.cfb -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.pptx -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.ps: -------------------------------------------------------------------------------- 1 | %!PS 2 | 3 | /Courier % name the desired font 4 | 20 selectfont % choose the size in points and establish 5 | % the font as the current one 6 | 72 500 moveto % position the current point at 7 | % coordinates 72, 500 (the origin is at the 8 | % lower-left corner of the page) 9 | (Hello world!) show % stroke the text in parentheses 10 | showpage % print all on the page 11 | -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.ps.mpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.ps.mpg -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.psd -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.qcp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.qcp -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.raf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.raf -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.rar -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.rpm -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\ansi\ansicpg1252\cocoartf1265\cocoasubrtf210 2 | {\fonttbl\f0\fswiss\fcharset0 Helvetica;} 3 | {\colortbl;\red255\green255\blue255;} 4 | \paperw11900\paperh16840\margl1440\margr1440\vieww10800\viewh8400\viewkind0 5 | \pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural 6 | 7 | \f0\fs24 \cf0 Test RTF file} -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.rw2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.rw2 -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.s3m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.s3m -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.shp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.shp -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.skp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.skp -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.spx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.spx -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.sqlite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.sqlite -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.stl: -------------------------------------------------------------------------------- 1 | solid SQUARE 2 | facet normal 0.0 0.0 1.0 3 | outer loop 4 | vertex 1.0 0.0 0.0 5 | vertex 0.5 0.5 0.0 6 | vertex 0.0 0.0 0.0 7 | endloop 8 | endfacet 9 | facet normal 0.0 0.0 1.0 10 | outer loop 11 | vertex 0.0 0.0 0.0 12 | vertex 0.5 0.5 0.0 13 | vertex 0.0 1.0 0.0 14 | endloop 15 | endfacet 16 | facet normal 0.0 0.0 1.0 17 | outer loop 18 | vertex 1.0 0.0 0.0 19 | vertex 1.0 1.0 0.0 20 | vertex 0.0 1.0 0.0 21 | endloop 22 | endfacet 23 | endsolid SQUARE 24 | -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.sub.mpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.sub.mpg -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.swf -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.tar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.tar -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.tar.Z: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.tar.Z -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.tar.gz -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.tar.lz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.tar.lz -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.tar.xz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.tar.xz -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.tif -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.ttf -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.vcf: -------------------------------------------------------------------------------- 1 | BEGIN:VCARD 2 | VERSION:3.0 3 | N:Gump;Forrest;;Mr.,; 4 | FN:Forrest Gump 5 | ORG:Bubba Gump Shrimp Co. 6 | TITLE:Shrimp Man 7 | PHOTO;VALUE=URI;TYPE=GIF:http://www.example.com/dir_photos/my_photo.gif 8 | TEL;TYPE=WORK,VOICE:(111) 555-1212 9 | TEL;TYPE=HOME,VOICE:(404) 555-1212 10 | ADR;TYPE=WORK,PREF:;;100 Waters Edge;Baytown;LA;30314;United States of America 11 | LABEL;TYPE=WORK,PREF:100 Waters Edge\nBaytown\, LA 30314\nUnited States of America 12 | ADR;TYPE=HOME:;;42 Plantation St.;Baytown;LA;30314;United States of America 13 | LABEL;TYPE=HOME:42 Plantation St.\nBaytown\, LA 30314\nUnited States of America 14 | EMAIL:forrestgump@example.com 15 | REV:2008-04-24T19:52:43Z 16 | END:VCARD 17 | -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.voc: -------------------------------------------------------------------------------- 1 | Creative Voice File 2 | ) -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.wasm: -------------------------------------------------------------------------------- 1 | asm ` 2 | addTwo 3 |  j -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.wav -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.webm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.webm -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.webp -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.wma.asf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.wma.asf -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.wmv.asf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.wmv.asf -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.woff -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.woff2 -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.wv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.wv -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.xcf -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.xls.cfb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.xls.cfb -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.xlsx -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.xm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.xm -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.xpi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.xpi -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.zip -------------------------------------------------------------------------------- /Tests/Fixtures/fixture.zst: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture.zst -------------------------------------------------------------------------------- /Tests/Fixtures/fixture2.3gp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture2.3gp -------------------------------------------------------------------------------- /Tests/Fixtures/fixture2.arw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture2.arw -------------------------------------------------------------------------------- /Tests/Fixtures/fixture2.dng: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture2.dng -------------------------------------------------------------------------------- /Tests/Fixtures/fixture2.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture2.docx -------------------------------------------------------------------------------- /Tests/Fixtures/fixture2.eps: -------------------------------------------------------------------------------- 1 | %!PS-Adobe-2.0 EPSF-1.2 %%Creator: Adobe Illustrator 88(TM) 1.6 %%For: (Timothy A. Tedder) () %%Title: (earth) %%CreationDate: (10/19/88) (2:29 PM) %%DocumentProcSets: Adobe_packedarray 0 0 %%DocumentSuppliedProcSets: Adobe_packedarray 0 0 %%DocumentProcSets: Adobe_cmykcolor 0 0 %%DocumentSuppliedProcSets: Adobe_cmykcolor 0 0 %%DocumentProcSets: Adobe_cshow 0 0 %%DocumentSuppliedProcSets: Adobe_cshow 0 0 %%DocumentProcSets: Adobe_customcolor 0 0 %%DocumentSuppliedProcSets: Adobe_customcolor 0 0 %%DocumentProcSets: Adobe_Illustrator_881 0 0 %%DocumentSuppliedProcSets: Adobe_Illustrator_881 0 0 %%ColorUsage: Black&White %%DocumentProcessColors: Black %%BoundingBox:119 246 394 521 %%TemplateBox:288 360 288 360 %%TileBox:-552 730 0 1460 %%EndComments %%BeginProcSet: Adobe_packedarray 0 0 % packedarray Operators % Version 1.0 5/9/1988 % Copyright (C) 1987, 1988 % Adobe Systems Incorporated % All Rights Reserved userdict /Adobe_packedarray 5 dict dup begin put /initialize % - initialize - { /packedarray where { pop } { Adobe_packedarray begin Adobe_packedarray { dup xcheck { bind } if userdict 3 1 roll put } forall end } ifelse } def /terminate % - terminate - { } def /packedarray % arguments count packedarray array { array astore readonly } def /setpacking % boolean setpacking - { pop } def /currentpacking % - setpacking boolean { false } def currentdict readonly pop end %%EndProcSet Adobe_packedarray /initialize get exec %%BeginProcSet:Adobe_cmykcolor 0 0 % cmykcolor Operators % Version 1.0 5/9/1988 % Copyright (C) 1987, 1988 % Adobe Systems Incorporated % All Rights Reserved currentpacking true setpacking userdict /Adobe_cmykcolor 4 dict dup begin put /initialize % - initialize - { /setcmykcolor where { pop } { userdict /Adobe_cmykcolor_vars 2 dict dup begin put /_setrgbcolor /setrgbcolor load def /_currentrgbcolor /currentrgbcolor load def Adobe_cmykcolor begin Adobe_cmykcolor { dup xcheck { bind } if pop pop } forall end end Adobe_cmykcolor begin } ifelse } def /terminate % - terminate - { currentdict Adobe_cmykcolor eq { end } if } def /setcmykcolor % cyan magenta yellow black setcmykcolor - { 1 sub 4 1 roll 3 { 3 index add neg dup 0 lt { pop 0 } if 3 1 roll } repeat Adobe_cmykcolor_vars /_setrgbcolor get exec pop } def /currentcmykcolor % - currentcmykcolor cyan magenta yellow black { Adobe_cmykcolor_vars /_currentrgbcolor get exec 3 { 1 sub neg 3 1 roll } repeat 0 } def currentdict readonly pop end setpacking %%EndProcSet %%BeginProcSet: Adobe_cshow 0 0 % cshow Operator % Version 1.0 5/9/1988 % Copyright (C) 1987, 1988 % Adobe Systems Incorporated % All Rights Reserved currentpacking true setpacking userdict /Adobe_cshow 3 dict dup begin put /initialize % - initialize - { /cshow where { pop } { userdict /Adobe_cshow_vars 1 dict dup begin put /_cshow % - _cshow proc {} def Adobe_cshow begin Adobe_cshow { dup xcheck { bind } if userdict 3 1 roll put } forall end end } ifelse } def /terminate % - terminate - { } def /cshow % string proc cshow - { Adobe_cshow_vars exch /_cshow exch put { 0 0 Adobe_cshow_vars /_cshow get exec } forall } def currentdict readonly pop end setpacking %%EndProcSet %%BeginProcSet: Adobe_customcolor 0 0 % Custom Color Operators % Version 1.0 5/9/1988 % Copyright (C) 1987, 1988 % Adobe Systems Incorporated % All Rights Reserved currentpacking true setpacking userdict /Adobe_customcolor 5 dict dup begin put /initialize % - initialize - { /setcustomcolor where { pop } { Adobe_customcolor begin Adobe_customcolor { dup xcheck { bind } if pop pop } forall end Adobe_customcolor begin } ifelse } def /terminate % - terminate - { currentdict Adobe_customcolor eq { end } if } def /findcmykcustomcolor % cyan magenta yellow black name findcmykcustomcolor object { 5 packedarray } def /setcustomcolor % object tint setcustomcolor - { exch aload pop pop 4 { 4 index mul 4 1 roll } repeat 5 -1 roll pop setcmykcolor } def /setoverprint % boolean setoverprint - { pop } def currentdict readonly pop end setpacking %%EndProcSet %%BeginProcSet: Adobe_Illustrator881 0 0 % Adobe Illustrator (TM) Prolog % Version 1.0 5/9/1988 % Copyright (C) 1987, 1988 % Adobe Systems Incorporated % All Rights Reserved currentpacking true setpacking userdict /Adobe_Illustrator881 72 dict dup begin put % initialization /initialize % - initialize - { userdict /Adobe_Illustrator881_vars 29 dict dup begin put % paint operands /_lp /none def /_pf {} def /_ps {} def /_psf {} def /_pss {} def % text operands /_a null def /_as null def /_tt 2 array def /_tl 2 array def /_tm matrix def /t {} def % color operands /_gf null def /_cf 4 array def /_if null def /_of false def /_fc {} def /_gs null def /_cs 4 array def /_is null def /_os false def /_sc {} def /_i null def Adobe_Illustrator881 begin Adobe_Illustrator881 { dup xcheck { bind } if pop pop } forall end end Adobe_Illustrator881 begin Adobe_Illustrator881_vars begin newpath } def /terminate % - terminate - { end end } def % definition operators /_ % - _ null null def /ddef % key value ddef - { Adobe_Illustrator881_vars 3 1 roll put } def /xput % key value literal xput - { dup load dup length exch maxlength eq { dup dup load dup length 2 mul dict copy def } if load begin def end } def /npop % integer npop - { { pop } repeat } def % marking operators /sw % ax ay length string sw x y { stringwidth exch 5 -1 roll 3 index 1 sub mul add 4 1 roll 3 1 roll 1 sub mul add } def /ss % ax ay length string matrix ss - { 3 -1 roll pop 4 1 roll { 2 npop (0) exch 2 copy 0 exch put pop gsave false charpath currentpoint 4 index setmatrix stroke grestore moveto 2 copy rmoveto } cshow 3 npop } def % path operators /sp % ax ay length string sp - { exch pop { 2 npop (0) exch 2 copy 0 exch put pop false charpath 2 copy rmoveto } cshow 2 npop } def % path construction operators /pl % x y pl x y { transform 0.25 sub round 0.25 add exch 0.25 sub round 0.25 add exch itransform } def /setstrokeadjust where { pop true setstrokeadjust /c % x1 y1 x2 y2 x3 y3 c - { curveto } def /C /c load def /v % x2 y2 x3 y3 v - { currentpoint 6 2 roll curveto } def /V /v load def /y % x1 y1 x2 y2 y - { 2 copy curveto } def /Y /y load def /l % x y l - { lineto } def /L /l load def /m % x y m - { moveto } def } { /c { pl curveto } def /C /c load def /v { currentpoint 6 2 roll pl curveto } def /V /v load def /y { pl 2 copy curveto } def /Y /y load def /l { pl lineto } def /L /l load def /m { pl moveto } def } ifelse % graphic state operators /d % array phase d - { setdash } def /cf % - cf flatness currentflat def /i % flatness i - { dup 0 eq { pop cf } if setflat } def /j % linejoin j - { setlinejoin } def /J % linecap J - { setlinecap } def /M % miterlimit M - { setmiterlimit } def /w % linewidth w - { setlinewidth } def % path painting operators /H % - H - {} def /h % - h - { closepath } def /N % - N - { newpath } def /n % - n - /N load def /F % - F - { _pf } def /f % - f - { closepath F } def /S % - S - { _ps } def /s % - s - { closepath S } def /B % - B - { gsave F grestore S } def /b % - b - { closepath B } def /W % - W - { clip } def % text painting operators /ta % length string ta ax ay length string { _as moveto _tt aload pop 4 -2 roll } def /tl % - tl - { _tl aload pop translate } def /as % - as array { { 0 0 } { 2 copy _tt aload pop 4 -2 roll sw exch neg 2 div exch neg 2 div } { 2 copy _tt aload pop 4 -2 roll sw exch neg exch neg } { 0 0 } } cvlit def /z % literal size leading tracking align z - { /_a exch ddef /_as as _a get ddef _a 2 le { 0 _tt astore pop 0 exch neg _tl astore pop } { 0 exch neg _tt astore pop neg 0 _tl astore pop } ifelse exch findfont exch scalefont setfont } def /tm % matrix tm - { _tm currentmatrix pop concat } def /I % matrix I - { tm /t { ta sp tl } ddef } def /o % matrix o - { tm /t { ta 4 npop tl newpath } ddef } def /e % matrix e - { tm /t { ta _psf tl newpath } ddef } def /r % matrix r - { tm /t { ta _tm _pss tl newpath } ddef } def /a % matrix a - { tm /t { 2 copy ta _psf newpath ta _tm _pss tl newpath } ddef } def /T % - T - { _tm setmatrix } def % font operators /Z % array literal literal direction Z - { pop findfont begin currentdict dup length 1 add dict begin { 1 index /FID ne { def } { 2 npop } ifelse } forall /FontName exch def dup length 0 ne { /Encoding Encoding 256 array copy def 0 exch { dup type /nametype eq { Encoding 2 index 2 index put pop 1 add } { exch pop } ifelse } forall } if pop currentdict dup end end /FontName get exch definefont pop } def % group operators /u % - u - {} def /U % - U - {} def /q % - q - { gsave } def /Q % - Q - { grestore } def % place operators /` % matrix llx lly urx ury string ` - { /_i save ddef 6 1 roll 4 npop concat userdict begin /showpage {} def false setoverprint pop } def /~ % - ~ - { end _i restore } def % color operators /O % flag O - { 0 ne /_of exch ddef /_lp /none ddef } def /R % flag R - { 0 ne /_os exch ddef /_lp /none ddef } def /g % gray g - { /_gf exch ddef /_fc { _lp /fill ne { _of setoverprint _gf setgray /_lp /fill ddef } if } ddef /_pf { _fc fill } ddef /_psf { _fc exch pop ashow } ddef /_lp /none ddef } def /G % gray G - { /_gs exch ddef /_sc { _lp /stroke ne { _os setoverprint _gs setgray /_lp /stroke ddef } if } ddef /_ps { _sc stroke } ddef /_pss { _sc ss } ddef /_lp /none ddef } def /k % cyan magenta yellow black k - { _cf astore pop /_fc { _lp /fill ne { _of setoverprint _cf aload pop setcmykcolor /_lp /fill ddef } if } ddef /_pf { _fc fill } ddef /_psf { _fc exch pop ashow } ddef /_lp /none ddef } def /K % cyan magenta yellow black K - { _cs astore pop /_sc { _lp /stroke ne { _os setoverprint _cs aload pop setcmykcolor /_lp /stroke ddef } if } ddef /_ps { _sc stroke } ddef /_pss { _sc ss } ddef /_lp /none ddef } def /x % cyan magenta yellow black name gray x - { /_gf exch ddef findcmykcustomcolor /_if exch ddef /_fc { _lp /fill ne { _of setoverprint _if _gf 1 exch sub setcustomcolor /_lp /fill ddef } if } ddef /_pf { _fc fill } ddef /_psf { _fc exch pop ashow } ddef /_lp /none ddef } def /X % cyan magenta yellow black name gray X - { /_gs exch ddef findcmykcustomcolor /_is exch ddef /_sc { _lp /stroke ne { _os setoverprint _is _gs 1 exch sub setcustomcolor /_lp /stroke ddef } if } ddef /_ps { _sc stroke } ddef /_pss { _sc ss } ddef /_lp /none ddef } def % locked object operators /A % value A - { pop } def currentdict readonly pop end setpacking %%EndProcSet %%EndProlog %%BeginSetup Adobe_cmykcolor /initialize get exec Adobe_cshow /initialize get exec Adobe_customcolor /initialize get exec Adobe_Illustrator881 /initialize get exec %%EndSetup 0 A u q 0 O 0 g 0 R 0 G 0 i 0 J 0 j 1 w 4 M []0 d %%Note: 289.7483 499.934 m 323.3996 489.1332 350.8221 464.5488 364.8541 432.0545 c 390.3671 372.9737 360.4601 299.753 300.8926 274.7434 c 241.5687 249.836 167.9347 279.1117 143.7827 339.0235 c 134.3854 362.3347 131.6141 386.862 137.3373 411.8925 c 145.5155 447.6591 157.8251 467.6706 191.9297 487.7602 c 222.0044 505.476 256.5007 510.6053 289.7483 499.934 c h W n 0.2 g 120.6329 385.5208 m 120.6329 459.3289 180.4681 519.164 254.2761 519.164 c 328.0841 519.164 387.9193 459.3289 387.9193 385.5208 c 387.9193 311.7128 328.0841 251.8777 254.2761 251.8777 c 180.4681 251.8777 120.6329 311.7128 120.6329 385.5208 c f u 0.2227 g 132.0236 388.6477 m 132.0236 457.0886 187.5077 512.5727 255.9486 512.5727 c 324.3895 512.5727 379.8736 457.0886 379.8736 388.6477 c 379.8736 320.2068 324.3895 264.7227 255.9486 264.7227 c 187.5077 264.7227 132.0236 320.2068 132.0236 388.6477 c f 0.2454 g 143.4163 391.7751 m 143.4163 454.8479 194.5486 505.9802 257.6214 505.9802 c 320.6943 505.9802 371.8265 454.8479 371.8265 391.7751 c 371.8265 328.7022 320.6943 277.5699 257.6214 277.5699 c 194.5486 277.5699 143.4163 328.7022 143.4163 391.7751 c f 0.2682 g 154.8089 394.9025 m 154.8089 452.6072 201.5894 499.3878 259.2942 499.3878 c 316.999 499.3878 363.7795 452.6072 363.7795 394.9025 c 363.7795 337.1977 316.999 290.4172 259.2942 290.4172 c 201.5894 290.4172 154.8089 337.1977 154.8089 394.9025 c f 0.2909 g 166.2015 398.0298 m 166.2015 450.3666 208.6302 492.7953 260.967 492.7953 c 313.3037 492.7953 355.7324 450.3666 355.7324 398.0298 c 355.7324 345.6931 313.3037 303.2644 260.967 303.2644 c 208.6302 303.2644 166.2015 345.6931 166.2015 398.0298 c f 0.3136 g 177.5941 401.1572 m 177.5941 448.1259 215.671 486.2028 262.6398 486.2028 c 309.6085 486.2028 347.6854 448.1259 347.6854 401.1572 c 347.6854 354.1885 309.6085 316.1116 262.6398 316.1116 c 215.671 316.1116 177.5941 354.1885 177.5941 401.1572 c f 0.3364 g 188.9868 404.2846 m 188.9868 445.8853 222.7119 479.6104 264.3125 479.6104 c 305.9132 479.6104 339.6383 445.8853 339.6383 404.2846 c 339.6383 362.6839 305.9132 328.9588 264.3125 328.9588 c 222.7119 328.9588 188.9868 362.6839 188.9868 404.2846 c f 0.3591 g 200.3794 407.412 m 200.3794 443.6446 229.7527 473.0179 265.9853 473.0179 c 302.218 473.0179 331.5913 443.6446 331.5913 407.412 c 331.5913 371.1793 302.218 341.806 265.9853 341.806 c 229.7527 341.806 200.3794 371.1793 200.3794 407.412 c f 0.3818 g 211.772 410.5393 m 211.772 441.404 236.7935 466.4255 267.6581 466.4255 c 298.5227 466.4255 323.5442 441.404 323.5442 410.5393 c 323.5442 379.6748 298.5227 354.6532 267.6581 354.6532 c 236.7935 354.6532 211.772 379.6748 211.772 410.5393 c f 0.4045 g 223.1646 413.6667 m 223.1646 439.1633 243.8343 459.833 269.3309 459.833 c 294.8274 459.833 315.4972 439.1633 315.4972 413.6667 c 315.4972 388.1702 294.8274 367.5005 269.3309 367.5005 c 243.8343 367.5005 223.1646 388.1702 223.1646 413.6667 c f 0.4273 g 234.5573 416.7941 m 234.5573 436.9226 250.8752 453.2405 271.0037 453.2405 c 291.1322 453.2405 307.4501 436.9226 307.4501 416.7941 c 307.4501 396.6656 291.1322 380.3477 271.0037 380.3477 c 250.8752 380.3477 234.5573 396.6656 234.5573 416.7941 c f U 0.45 g 245.948 419.921 m 245.948 434.6824 257.9148 446.6492 272.6762 446.6492 c 287.4376 446.6492 299.4044 434.6824 299.4044 419.921 c 299.4044 405.1596 287.4376 393.1927 272.6762 393.1927 c 257.9148 393.1927 245.948 405.1596 245.948 419.921 c f Q 0 O 0 g 0 R 0 G 0 i 0 J 0 j 1 w 4 M []0 d %%Note: 289.7483 499.934 m 323.3996 489.1332 350.8221 464.5488 364.8541 432.0545 c 390.3671 372.9737 360.4601 299.753 300.8926 274.7434 c 241.5687 249.836 167.9347 279.1117 143.7827 339.0235 c 134.3854 362.3347 131.6141 386.862 137.3373 411.8925 c 145.5155 447.6591 157.8251 467.6706 191.9297 487.7602 c 222.0044 505.476 256.5007 510.6053 289.7483 499.934 c s 1 g 0.5 w 262.9362 494.878 m 263.9038 495.9616 264.029 497.0776 263.6135 497.9427 c 262.428 500.4107 259.8451 498.5589 258.7761 497.0208 C 258.1363 498.4351 256.8504 498.1583 255.8006 497.9151 c 255.004 497.7306 254.317 496.9224 254.8631 496.077 c 255.6469 494.8637 256.6282 493.6156 257.8426 493.2309 c 259.3329 492.7589 260.7498 492.4297 262.9362 494.878 c b 246.261 490.0954 m 247.0191 495.3287 247.1764 499.5381 251.6501 503.1758 c 252.3093 503.7118 251.5041 504.8194 250.7648 504.878 c 246.1479 505.2436 237.1615 504.8332 235.8237 502.4362 c 233.7228 498.6722 235.8776 491.4663 241.0037 488.4015 c 242.3837 487.5763 245.7645 486.6679 246.261 490.0954 c b 221.7933 487.0311 m 222.2423 486.2785 222.8567 485.611 223.7408 486.0865 c 226.5326 487.588 222.6996 489.3542 223.7761 491.0208 C 225.1099 489.6871 226.4425 488.3545 227.7761 487.0208 C 231.1632 492.2806 223.8779 497.3235 220.359 499.2646 c 216.5141 501.3856 212.9676 494.4472 210.7761 492.0208 C 214.6938 490.2114 219.1382 491.4814 221.7933 487.0311 c b 219.4496 475.1803 m 217.2548 480.8589 214.9571 485.8608 209.5444 487.2241 c 208.3401 487.5274 205.9487 484.81 204.9404 482.783 c 202.4377 477.752 209.3265 475.0647 207.878 471.2099 c 206.695 468.0619 206.5051 464.2489 204.3433 461.1545 c 203.4441 459.8674 201.5381 461.562 200.8447 462.9608 c 200.1052 464.4525 201.7189 466.7855 199.6509 467.7631 c 195.4009 469.7723 187.4771 470.989 188.3149 476.8093 c 188.9238 481.0387 195.1368 482.9055 195.5333 487.9101 c 195.5857 488.5717 194.6187 489.3568 193.776 488.8036 c 182.5886 481.4583 171.3027 475.5423 163.0261 465.3958 c 147.0595 445.8222 132.091 418.4364 140.7136 391.8958 C 144.2369 398.2317 136.3142 404.56 140.7136 410.8958 C 143.3919 402.1176 145.3569 393.5363 152.2552 386.4497 c 152.8715 385.8166 150.907 382.7934 151.947 381.0338 c 155.1274 375.6534 161.797 374.5592 167.7136 374.8958 C 167.2928 371.7261 170.0157 369.9832 171.8688 369.3494 c 180.6928 366.3307 187.049 360.8411 194.8662 356.1501 c 196.9756 354.8843 196.2676 358.8141 197.6913 358.672 c 205.2502 357.9173 205.856 350.0908 207.0701 343.9665 c 207.3868 342.3684 210.0023 341.4284 210.3812 339.8177 c 211.3784 335.5789 209.4697 330.6396 211.3356 327.2369 c 216.4342 317.9387 231.7717 315.7572 234.4636 306.6458 c 237.7136 295.6458 237.5532 281.9055 241.9621 269.9878 c 242.5616 268.3672 244.1946 266.5581 245.7822 266.2557 c 248.9949 265.6439 260.1357 265.6306 262.4584 266.5446 c 268.1426 268.7815 275.9636 274.3958 276.6494 278.1308 c 279.1081 291.5213 288.3125 290.4866 292.0735 297.2517 c 293.3588 299.5637 293.0046 303.4012 292.2678 307.009 c 291.3356 311.5736 296.06 314.2964 298.3463 318.1157 c 299.4239 319.916 301.023 323.1725 299.3826 324.4808 c 291.6107 330.6793 282.2473 333.5366 272.7136 329.8958 C 271.679 333.3266 275.1378 336.3038 273.0433 340.0788 c 272.4035 341.232 273.1099 343.5575 273.085 344.8841 c 272.927 353.3242 268.3777 361.9687 257.7574 362.615 c 254.4437 362.8166 254.3365 368.8336 250.6923 370.8573 c 242.0101 375.6786 234.0391 370.1833 225.7136 367.8958 C 225.6417 368.9832 226.1112 370.7205 224.7233 370.6631 c 217.2654 370.354 208.1444 366.1258 207.7136 357.8958 C 205.0878 359.1552 203.941 362.5496 200.7082 362.8338 c 198.3213 363.0437 196.072 360.9694 193.7825 362.0426 c 192.5648 362.6134 191.3771 363.7481 190.8861 364.9654 c 189.7628 367.7501 192.5051 371.6355 189.5049 373.5725 c 187.0301 375.1703 182.2637 372.1887 181.3511 375.0959 c 180.5628 377.607 186.6741 382.6222 183.457 384.4423 c 180.6287 386.0426 177.4147 384.1035 174.3916 382.5047 c 167.5434 378.883 161.5311 387.4385 160.3434 394.0097 c 159.1788 400.4532 161.181 408.6551 167.8732 411.5235 c 171.8335 413.221 176.6781 409.4493 180.5016 411.3275 c 182.4996 412.309 184.905 413.7755 186.4141 412.5323 c 189.4681 410.016 193.6844 409.3116 195.5327 405.8006 c 196.6171 403.7409 194.2784 400.8098 196.8082 399.0303 c 196.8784 398.9809 197.3786 399.5608 197.7136 399.8958 C 197.1685 396.2387 199.6003 393.3354 200.7136 389.8958 C 201.7147 390.8969 203.155 391.7468 203.481 392.9585 c 205.4984 400.456 199.5463 408.4574 202.7416 414.3372 c 206.2251 420.7472 209.5076 426.8985 213.018 433.7397 c 214.4742 436.5776 217.1338 438.6911 219.7963 440.791 c 220.5525 441.3875 221.0831 440.4498 221.7747 439.987 c 222.6111 439.4272 223.6213 440.2459 223.5098 440.8587 c 223.3982 441.4718 222.2018 442.341 222.8303 442.6783 c 226.2465 444.5119 228.1605 447.4301 230.7136 449.8958 C 226.2239 453.2582 220.035 448.8928 216.7136 444.8958 C 222.8849 449.8136 225.1703 460.8635 234.7136 456.8958 C 235.8882 460.7527 241.8715 459.8852 241.7252 461.8211 c 241.1125 469.9232 231.998 474.5171 226.7136 480.8958 C 225.5663 479.0559 225.4812 476.7725 224.4154 475.0841 c 223.5966 473.7867 221.5572 469.7268 219.4496 475.1803 c b 249.7922 448.0593 m 250.7217 447.6692 251.505 448.2479 251.6604 449.0434 c 252.5609 453.653 247.2679 453.2509 245.7761 456.0208 C 245.4394 455.6842 245.1038 455.1253 244.78 455.1363 c 243.1977 455.1898 244.2984 458.0949 242.829 457.7765 c 239.4154 457.037 241.9164 452.8662 239.7761 451.0208 C 243.0007 449.6536 246.5276 449.4293 249.7922 448.0593 c b 298.6886 481.156 m 301.8026 483.1714 298.3354 486.4673 296.7543 486.539 c 294.9557 486.6204 295.7592 483.6663 295.958 482.0431 c 296.1208 480.7135 297.7139 480.5252 298.6886 481.156 c b 304.3822 481.1275 m 304.1183 480.1533 303.6413 479.0982 303.8806 478.0446 c 304.229 476.5104 306.2117 476.7436 306.4942 477.1966 c 308.2003 479.9326 310.5241 479.3387 311.3297 482.1488 c 312.842 487.4244 305.5648 486.3447 302.9461 489.1779 c 302.4362 489.7297 302.9557 491.0518 302.6863 491.9952 c 302.4607 492.7855 301.5234 493.5389 300.8982 492.9012 c 296.0264 487.9319 305.7106 486.0319 304.3822 481.1275 c b 315.7649 478.9803 m 313.119 479.7079 312.3219 477.2227 310.7761 476.0208 C 311.4426 475.3543 312.0104 474.3835 312.8164 474.182 c 314.7507 473.6985 316.9925 474.5319 318.6585 473.7653 c 322.1959 472.1373 323.7502 467.5142 323.1033 464.1502 c 321.9755 458.2864 315.0336 460.6195 309.8228 459.7433 c 308.6534 459.5467 307.5293 458.1711 306.9075 456.9537 c 306.0205 455.2169 308.1732 454.2713 308.4612 452.9521 c 309.2362 449.4015 308.3715 443.9141 311.8068 443.7742 c 315.7832 443.6122 318.925 447.4477 323.7822 447.3605 c 324.7653 447.3429 326.4761 449.0554 326.4241 450.0014 c 326.1186 455.55 325.1462 461.5031 330.0952 464.4926 c 333.6101 466.6157 339.2649 466.0933 342.948 463.2429 c 343.1583 463.0802 344.2775 464.2138 343.6656 464.9259 c 336.0389 473.8014 327.6993 480.4107 317.7184 486.9325 c 316.8765 487.4826 315.8357 486.6016 315.9922 486.0865 c 316.3608 484.8728 318.0582 484.1698 318.6295 482.9521 c 319.4335 481.2381 318.7872 478.1492 315.7649 478.9803 c b 335.8932 456.9075 m 335.2636 456.2568 336.0755 455.1817 336.7759 455.1825 c 337.4766 455.1833 338.2894 456.2566 337.6589 456.9072 c 337.3285 457.2481 336.2223 457.2475 335.8932 456.9075 c b 345.6561 451.1443 m 346.2943 451.7646 345.4771 452.5368 344.7761 453.0208 C 344.3766 451.4521 341.669 452.4946 342.0344 451.0879 c 342.6272 448.8055 344.6541 450.1703 345.6561 451.1443 c b 345.6136 457.008 m 345.744 455.354 347.2075 455.0874 347.7761 454.0208 C 350.6015 457.253 347.6156 462.2134 344.7464 462.3383 c 342.1785 462.45 345.4673 458.8636 345.6136 457.008 c b 339.8964 387.445 m 345.2477 385.9283 353.2441 390.7796 354.3547 382.961 c 355.0814 377.8452 356.0482 373.4821 358.2538 368.776 c 360.6779 363.604 357.6652 357.669 356.2543 352.1543 c 355.3741 348.714 352.6667 345.7619 350.041 342.7871 c 348.0474 340.5285 348.6645 336.9477 348.2582 333.9554 c 347.6854 329.7359 351.5231 321.3322 353.7612 323.2225 c 364.6913 332.4542 372.0321 360.5778 373.424 375.0547 c 375.4573 396.2029 372.3386 420.5833 360.2041 439.6551 c 357.2261 444.3356 350.7969 441.895 345.8619 443.3183 c 344.246 443.7844 343.3053 446.2304 341.6876 446.74 c 335.3839 448.7257 329.5215 444.5618 324.3494 440.5743 c 322.3254 439.0138 320.0442 443.219 316.7913 441.9809 c 314.5552 441.1297 314.6569 438.6022 314.1122 436.9125 c 313.0832 433.7205 314.2317 430.3247 315.3881 426.8902 c 316.3586 424.0074 313.5326 421.4991 312.2302 418.8016 c 308.5155 411.1074 311.2912 402.3222 311.2242 394.0172 c 311.2136 392.6942 313.2467 390.9395 314.8687 390.2336 c 319.5544 388.1944 324.6825 388.2089 329.8298 387.3384 c 333.0988 386.7855 336.136 388.5107 339.8964 387.445 c b U %%Trailer Adobe_Illustrator881 /terminate get exec Adobe_customcolor /terminate get exec Adobe_cshow /terminate get exec Adobe_cmykcolor /terminate get exec -------------------------------------------------------------------------------- /Tests/Fixtures/fixture2.jxl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture2.jxl -------------------------------------------------------------------------------- /Tests/Fixtures/fixture2.mkv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture2.mkv -------------------------------------------------------------------------------- /Tests/Fixtures/fixture2.mpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture2.mpg -------------------------------------------------------------------------------- /Tests/Fixtures/fixture2.nef: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture2.nef -------------------------------------------------------------------------------- /Tests/Fixtures/fixture2.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture2.pptx -------------------------------------------------------------------------------- /Tests/Fixtures/fixture2.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture2.xlsx -------------------------------------------------------------------------------- /Tests/Fixtures/fixture3.arw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture3.arw -------------------------------------------------------------------------------- /Tests/Fixtures/fixture3.nef: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture3.nef -------------------------------------------------------------------------------- /Tests/Fixtures/fixture4.arw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture4.arw -------------------------------------------------------------------------------- /Tests/Fixtures/fixture4.nef: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture4.nef -------------------------------------------------------------------------------- /Tests/Fixtures/fixture5.arw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/velocityzen/FileType/6fee44c9f0b6b22637ed67adeb5b550432c66145/Tests/Fixtures/fixture5.arw -------------------------------------------------------------------------------- /Tests/LinuxMain.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | 3 | import FileTypeTests 4 | 5 | var tests = [XCTestCaseEntry]() 6 | tests += FileTypeTests.allTests() 7 | XCTMain(tests) 8 | --------------------------------------------------------------------------------