Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for J2C #596

Merged
merged 2 commits into from
Apr 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions core.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export type FileExtension =
| 'xlsx'
| '3gp'
| '3g2'
| 'j2c'
| 'jp2'
| 'jpm'
| 'jpx'
Expand Down Expand Up @@ -236,6 +237,7 @@ export type MimeType =
| 'video/mp2t'
| 'application/x-blender'
| 'image/bpg'
| 'image/j2c'
| 'image/jp2'
| 'image/jpx'
| 'image/jpm'
Expand Down
7 changes: 7 additions & 0 deletions core.js
Original file line number Diff line number Diff line change
Expand Up @@ -1201,6 +1201,13 @@ class FileTypeParser {
};
}

if (this.check([0xFF, 0x4F, 0xFF, 0x51])) {
return {
ext: 'j2c',
mime: 'image/j2c',
};
}

if (this.check([0x00, 0x00, 0x00, 0x0C, 0x6A, 0x50, 0x20, 0x20, 0x0D, 0x0A, 0x87, 0x0A])) {
// JPEG-2000 family

Expand Down
Binary file added fixture/fixture.j2c
Binary file not shown.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@
"pptx",
"xlsx",
"3gp",
"j2c",
"jp2",
"jpm",
"jpx",
Expand Down
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ Returns a `Set<string>` of supported MIME types.
- [`ics`](https://en.wikipedia.org/wiki/ICalendar#Data_format) - iCalendar
- [`indd`](https://en.wikipedia.org/wiki/Adobe_InDesign#File_format) - Adobe InDesign document
- [`it`](https://wiki.openmpt.org/Manual:_Module_formats#The_Impulse_Tracker_format_.28.it.29) - Audio module format: Impulse Tracker
- [`j2c`](https://en.wikipedia.org/wiki/JPEG_2000) - JPEG 2000
- [`jls`](https://en.wikipedia.org/wiki/Lossless_JPEG#JPEG-LS) - Lossless/near-lossless compression standard for continuous-tone images
- [`jp2`](https://en.wikipedia.org/wiki/JPEG_2000) - JPEG 2000
- [`jpg`](https://en.wikipedia.org/wiki/JPEG) - Joint Photographic Experts Group image
Expand Down
2 changes: 2 additions & 0 deletions supported.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export const extensions = [
'xlsx',
'3gp',
'3g2',
'j2c',
'jp2',
'jpm',
'jpx',
Expand Down Expand Up @@ -232,6 +233,7 @@ export const mimeTypes = [
'video/mp2t',
'application/x-blender',
'image/bpg',
'image/j2c',
'image/jp2',
'image/jpx',
'image/jpm',
Expand Down
3 changes: 3 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,9 @@ const names = {
dwg: [
'fixture-line-weights',
],
j2c: [
'fixture',
],
cpio: [
'fixture-bin',
'fixture-ascii',
Expand Down