diff --git a/core.d.ts b/core.d.ts index f79f7b7b..1f3cf074 100644 --- a/core.d.ts +++ b/core.d.ts @@ -50,6 +50,7 @@ export type FileExtension = | 'epub' | 'mobi' | 'elf' + | 'macho' | 'exe' | 'swf' | 'rtf' @@ -209,6 +210,7 @@ export type MimeType = | 'audio/amr' | 'application/pdf' | 'application/x-elf' + | 'application/x-mach-binary' | 'application/x-msdownload' | 'application/x-shockwave-flash' | 'application/rtf' diff --git a/core.js b/core.js index c3014494..8145965b 100644 --- a/core.js +++ b/core.js @@ -855,6 +855,13 @@ class FileTypeParser { }; } + if (this.check([0xCF, 0xFA, 0xED, 0xFE])) { + return { + ext: 'macho', + mime: 'application/x-mach-binary', + }; + } + // -- 5-byte signatures -- if (this.check([0x4F, 0x54, 0x54, 0x4F, 0x00])) { diff --git a/fixture/fixture.macho b/fixture/fixture.macho new file mode 100755 index 00000000..17407f58 Binary files /dev/null and b/fixture/fixture.macho differ diff --git a/package.json b/package.json index ad155899..9e945b88 100644 --- a/package.json +++ b/package.json @@ -52,6 +52,7 @@ "is", "exif", "elf", + "macho", "exe", "binary", "buffer", diff --git a/readme.md b/readme.md index cd50d930..aa0bc799 100644 --- a/readme.md +++ b/readme.md @@ -388,6 +388,7 @@ Returns a `Set` of supported MIME types. - [`m4b`](https://en.wikipedia.org/wiki/M4B) - Audiobook and podcast MPEG-4 files, which also contain metadata including chapter markers, images, and hyperlinks - [`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 - [`m4v`](https://en.wikipedia.org/wiki/M4V) - Video container format developed by Apple, which is very similar to the MP4 format +- [`macho`](https://en.wikipedia.org/wiki/Mach-O) - Mach-O binary format - [`mid`](https://en.wikipedia.org/wiki/MIDI) - Musical Instrument Digital Interface file - [`mie`](https://en.wikipedia.org/wiki/Sidecar_file) - Dedicated meta information format which supports storage of binary as well as textual meta information - [`mj2`](https://en.wikipedia.org/wiki/Motion_JPEG_2000) - Motion JPEG 2000 diff --git a/supported.js b/supported.js index 6b2545f9..5b913777 100644 --- a/supported.js +++ b/supported.js @@ -48,6 +48,7 @@ export const extensions = [ 'pdf', 'epub', 'elf', + 'macho', 'exe', 'swf', 'rtf', @@ -206,6 +207,7 @@ export const mimeTypes = [ 'audio/amr', 'application/pdf', 'application/x-elf', + 'application/x-mach-binary', 'application/x-msdownload', 'application/x-shockwave-flash', 'application/rtf',