diff --git a/fixture/fixture.alias b/fixture/fixture.alias new file mode 100644 index 00000000..e1b93177 Binary files /dev/null and b/fixture/fixture.alias differ diff --git a/fixture/fixture.lnk b/fixture/fixture.lnk new file mode 100644 index 00000000..5a83bc25 Binary files /dev/null and b/fixture/fixture.lnk differ diff --git a/index.d.ts b/index.d.ts index 78f02db8..797219ce 100644 --- a/index.d.ts +++ b/index.d.ts @@ -95,7 +95,9 @@ declare namespace fileType { | 'ics' | 'glb' | 'pcap' - | 'dsf'; + | 'dsf' + | 'lnk' + | 'alias'; interface FileTypeResult { /** diff --git a/index.js b/index.js index 82e2a830..36217bbd 100644 --- a/index.js +++ b/index.js @@ -919,6 +919,20 @@ const fileType = input => { mime: 'audio/x-dsf' // Non-standard }; } + + if (check([0x4C, 0x00, 0x00, 0x00, 0x01, 0x14, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46])) { + return { + ext: 'lnk', + mime: 'application/x.ms.shortcut' // Invented by us + }; + } + + if (check([0x62, 0x6F, 0x6F, 0x6B, 0x00, 0x00, 0x00, 0x00, 0x6D, 0x61, 0x72, 0x6B, 0x00, 0x00, 0x00, 0x00])) { + return { + ext: 'alias', + mime: 'application/x.apple.alias' // Invented by us + }; + } }; module.exports = fileType; diff --git a/package.json b/package.json index bf39170b..2a39ce3b 100644 --- a/package.json +++ b/package.json @@ -120,7 +120,9 @@ "ics", "glb", "pcap", - "dsf" + "dsf", + "lnk", + "alias" ], "devDependencies": { "@types/node": "^11.12.2", diff --git a/readme.md b/readme.md index a4eda412..35d56ff0 100644 --- a/readme.md +++ b/readme.md @@ -217,6 +217,8 @@ Type: [`stream.Readable`](https://nodejs.org/api/stream.html#stream_class_stream - [`glb`](https://github.com/KhronosGroup/glTF) - GL Transmission Format - [`pcap`](https://wiki.wireshark.org/Development/LibpcapFileFormat) - Libpcap File Format - [`dsf`](https://dsd-guide.com/sites/default/files/white-papers/DSFFileFormatSpec_E.pdf) - Sony DSD Stream File (DSF) +- [`lnk`](https://en.wikipedia.org/wiki/Shortcut_%28computing%29#Microsoft_Windows) - Microsoft Windows file shortcut +- [`alias`](https://en.wikipedia.org/wiki/Alias_%28Mac_OS%29) - macOS Alias file *SVG isn't included as it requires the whole file to be read, but you can get it [here](https://github.com/sindresorhus/is-svg).* diff --git a/test.js b/test.js index e4c79097..d0d4ba27 100644 --- a/test.js +++ b/test.js @@ -104,7 +104,9 @@ const types = [ 'ics', 'glb', 'pcap', - 'dsf' + 'dsf', + 'lnk', + 'alias' ]; // Define an entry here only if the fixture has a different