From 935470e0df2c31da44958f289d4eea3cc80d0d0e Mon Sep 17 00:00:00 2001 From: Daniel Freire Date: Sun, 23 Apr 2023 05:04:38 -0300 Subject: [PATCH] Add support for ARJ (#589) Co-authored-by: Sindre Sorhus --- core.d.ts | 2 ++ core.js | 7 +++++++ fixture/fixture.arj | Bin 0 -> 124 bytes package.json | 3 ++- readme.md | 1 + supported.js | 2 ++ 6 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 fixture/fixture.arj diff --git a/core.d.ts b/core.d.ts index f65d949e..032533fc 100644 --- a/core.d.ts +++ b/core.d.ts @@ -146,6 +146,7 @@ export type FileExtension = | 'dwg' | 'parquet' | 'class' + | 'arj' ; // eslint-disable-line semi-style export type MimeType = @@ -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 = { diff --git a/core.js b/core.js index 5f1ee351..1c174829 100644 --- a/core.js +++ b/core.js @@ -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 diff --git a/fixture/fixture.arj b/fixture/fixture.arj new file mode 100644 index 0000000000000000000000000000000000000000..7bce8c7eee01ac82fcbdd2fc24b48753c024161c GIT binary patch literal 124 zcmYdzrO%+m&B!Fcz$AJ~P%Q<788ARvW<^P9QL0{IQ5FNk->B{L85j~?nKI~sH8Px1 e#n7}w5Ml;M1}2-DTToKTz;JttgCa;f0|NkbMiz|# literal 0 HcmV?d00001 diff --git a/package.json b/package.json index 0fdea9d6..37d5887b 100644 --- a/package.json +++ b/package.json @@ -198,7 +198,8 @@ "pst", "dwg", "parquet", - "class" + "class", + "arj" ], "dependencies": { "readable-web-to-node-stream": "^3.0.2", diff --git a/readme.md b/readme.md index 9081db4e..de75240e 100644 --- a/readme.md +++ b/readme.md @@ -351,6 +351,7 @@ Returns a `Set` 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 diff --git a/supported.js b/supported.js index 631d07a4..10481f89 100644 --- a/supported.js +++ b/supported.js @@ -143,6 +143,7 @@ export const extensions = [ 'dwg', 'parquet', 'class', + 'arj', ]; export const mimeTypes = [ @@ -285,4 +286,5 @@ export const mimeTypes = [ 'image/vnd.dwg', 'application/x-parquet', 'application/java-vm', + 'application/x-arj', ];