Skip to content

Commit

Permalink
Add support for ICNS (#356)
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-lynch authored May 15, 2020
1 parent 40f63b4 commit 6ec2897
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions core.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ declare namespace core {
| 'raf'
| 'tif'
| 'bmp'
| 'icns'
| 'jxr'
| 'psd'
| 'zip'
Expand Down Expand Up @@ -143,6 +144,7 @@ declare namespace core {
| 'image/x-canon-cr3'
| 'image/tiff'
| 'image/bmp'
| 'image/icns'
| 'image/vnd.ms-photo'
| 'image/vnd.adobe.photoshop'
| 'application/epub+zip'
Expand Down
7 changes: 7 additions & 0 deletions core.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,13 @@ async function _fromTokenizer(tokenizer) {
};
}

if (checkString('icns', {offset: 0})) {
return {
ext: 'icns',
mime: 'image/icns'
};
}

// Zip-based file formats
// Need to be before the `zip` check
if (check([0x50, 0x4B, 0x3, 0x4])) { // Local file header signature
Expand Down
Binary file added fixture/fixture.icns
Binary file not shown.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"raf",
"tif",
"bmp",
"icns",
"jxr",
"psd",
"zip",
Expand Down
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ Returns a set of supported MIME types.
- [`raf`](https://en.wikipedia.org/wiki/Raw_image_format) - Fujifilm RAW image file
- [`tif`](https://en.wikipedia.org/wiki/Tagged_Image_File_Format)
- [`bmp`](https://en.wikipedia.org/wiki/BMP_file_format)
- [`icns`](https://en.wikipedia.org/wiki/Apple_Icon_Image_format)
- [`jxr`](https://en.wikipedia.org/wiki/JPEG_XR)
- [`psd`](https://en.wikipedia.org/wiki/Adobe_Photoshop#File_format)
- [`zip`](https://en.wikipedia.org/wiki/Zip_(file_format))
Expand Down
2 changes: 2 additions & 0 deletions supported.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ module.exports = {
'raf',
'tif',
'bmp',
'icns',
'jxr',
'psd',
'zip',
Expand Down Expand Up @@ -223,6 +224,7 @@ module.exports = {
'image/heif-sequence',
'image/heic',
'image/heic-sequence',
'image/icns',
'image/ktx',
'application/dicom',
'audio/x-musepack',
Expand Down

0 comments on commit 6ec2897

Please sign in to comment.