Skip to content

Commit

Permalink
Add support for ARJ (#589)
Browse files Browse the repository at this point in the history
Co-authored-by: Sindre Sorhus <[email protected]>
  • Loading branch information
dcfreire and sindresorhus authored Apr 23, 2023
1 parent cd011b4 commit 935470e
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions core.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ export type FileExtension =
| 'dwg'
| 'parquet'
| 'class'
| 'arj'
; // eslint-disable-line semi-style

export type MimeType =
Expand Down Expand Up @@ -288,6 +289,7 @@ export type MimeType =
| 'image/vnd.dwg'
| 'application/x-parquet'
| 'application/java-vm'
| 'application/x-arj'
; // eslint-disable-line semi-style

export type FileTypeResult = {
Expand Down
7 changes: 7 additions & 0 deletions core.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,13 @@ class FileTypeParser {
};
}

if (this.check([0x60, 0xEA])) {
return {
ext: 'arj',
mime: 'application/x-arj',
};
}

// -- 3-byte signatures --

if (this.check([0xEF, 0xBB, 0xBF])) { // UTF-8-BOM
Expand Down
Binary file added fixture/fixture.arj
Binary file not shown.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@
"pst",
"dwg",
"parquet",
"class"
"class",
"arj"
],
"dependencies": {
"readable-web-to-node-stream": "^3.0.2",
Expand Down
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ Returns a `Set<string>` of supported MIME types.
- [`ape`](https://en.wikipedia.org/wiki/Monkey%27s_Audio) - Monkey's Audio
- [`apng`](https://en.wikipedia.org/wiki/APNG) - Animated Portable Network Graphics
- [`ar`](https://en.wikipedia.org/wiki/Ar_(Unix)) - Archive file
- [`arj`](https://en.wikipedia.org/wiki/ARJ) - Archive file
- [`arrow`](https://arrow.apache.org) - Columnar format for tables of data
- [`arw`](https://en.wikipedia.org/wiki/Raw_image_format#ARW) - Sony Alpha Raw image file
- [`asar`](https://github.com/electron/asar#format) - Archive format primarily used to enclose Electron applications
Expand Down
2 changes: 2 additions & 0 deletions supported.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ export const extensions = [
'dwg',
'parquet',
'class',
'arj',
];

export const mimeTypes = [
Expand Down Expand Up @@ -285,4 +286,5 @@ export const mimeTypes = [
'image/vnd.dwg',
'application/x-parquet',
'application/java-vm',
'application/x-arj',
];

0 comments on commit 935470e

Please sign in to comment.