Skip to content

Commit 51bd34c

Browse files
authored
Add support for J2C (sindresorhus#596)
1 parent 1899fc1 commit 51bd34c

File tree

7 files changed

+16
-0
lines changed

7 files changed

+16
-0
lines changed

core.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ export type FileExtension =
8383
| 'xlsx'
8484
| '3gp'
8585
| '3g2'
86+
| 'j2c'
8687
| 'jp2'
8788
| 'jpm'
8889
| 'jpx'
@@ -236,6 +237,7 @@ export type MimeType =
236237
| 'video/mp2t'
237238
| 'application/x-blender'
238239
| 'image/bpg'
240+
| 'image/j2c'
239241
| 'image/jp2'
240242
| 'image/jpx'
241243
| 'image/jpm'

core.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,6 +1201,13 @@ class FileTypeParser {
12011201
};
12021202
}
12031203

1204+
if (this.check([0xFF, 0x4F, 0xFF, 0x51])) {
1205+
return {
1206+
ext: 'j2c',
1207+
mime: 'image/j2c',
1208+
};
1209+
}
1210+
12041211
if (this.check([0x00, 0x00, 0x00, 0x0C, 0x6A, 0x50, 0x20, 0x20, 0x0D, 0x0A, 0x87, 0x0A])) {
12051212
// JPEG-2000 family
12061213

fixture/fixture.j2c

6.26 KB
Binary file not shown.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@
132132
"pptx",
133133
"xlsx",
134134
"3gp",
135+
"j2c",
135136
"jp2",
136137
"jpm",
137138
"jpx",

readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,7 @@ Returns a `Set<string>` of supported MIME types.
400400
- [`ics`](https://en.wikipedia.org/wiki/ICalendar#Data_format) - iCalendar
401401
- [`indd`](https://en.wikipedia.org/wiki/Adobe_InDesign#File_format) - Adobe InDesign document
402402
- [`it`](https://wiki.openmpt.org/Manual:_Module_formats#The_Impulse_Tracker_format_.28.it.29) - Audio module format: Impulse Tracker
403+
- [`j2c`](https://en.wikipedia.org/wiki/JPEG_2000) - JPEG 2000
403404
- [`jls`](https://en.wikipedia.org/wiki/Lossless_JPEG#JPEG-LS) - Lossless/near-lossless compression standard for continuous-tone images
404405
- [`jp2`](https://en.wikipedia.org/wiki/JPEG_2000) - JPEG 2000
405406
- [`jpg`](https://en.wikipedia.org/wiki/JPEG) - Joint Photographic Experts Group image

supported.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ export const extensions = [
8181
'xlsx',
8282
'3gp',
8383
'3g2',
84+
'j2c',
8485
'jp2',
8586
'jpm',
8687
'jpx',
@@ -232,6 +233,7 @@ export const mimeTypes = [
232233
'video/mp2t',
233234
'application/x-blender',
234235
'image/bpg',
236+
'image/j2c',
235237
'image/jp2',
236238
'image/jpx',
237239
'image/jpm',

test.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,9 @@ const names = {
243243
dwg: [
244244
'fixture-line-weights',
245245
],
246+
j2c: [
247+
'fixture',
248+
],
246249
cpio: [
247250
'fixture-bin',
248251
'fixture-ascii',

0 commit comments

Comments
 (0)