From 329ff85a4877b12b754c578a66222074454cf4ab Mon Sep 17 00:00:00 2001 From: Daniel Freire Date: Thu, 30 Mar 2023 19:57:49 -0300 Subject: [PATCH 1/6] Add arj file support --- core.d.ts | 3 ++- core.js | 7 +++++++ readme.md | 1 + supported.js | 1 + 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/core.d.ts b/core.d.ts index 2cb39b27..b20a308f 100644 --- a/core.d.ts +++ b/core.d.ts @@ -144,7 +144,8 @@ export type FileExtension = | 'jls' | 'pst' | 'dwg' - | 'parquet'; + | 'parquet' + | 'arj'; export type MimeType = | 'image/jpeg' diff --git a/core.js b/core.js index 345e45c9..3abb6cbf 100644 --- a/core.js +++ b/core.js @@ -144,6 +144,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/readme.md b/readme.md index ab0e257a..740420b6 100644 --- a/readme.md +++ b/readme.md @@ -353,6 +353,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 2bb88fb5..7a755e76 100644 --- a/supported.js +++ b/supported.js @@ -142,6 +142,7 @@ export const extensions = [ 'pst', 'dwg', 'parquet', + 'arj', ]; export const mimeTypes = [ From 585d74a688bd7cbcec19f3e11f84eface287471f Mon Sep 17 00:00:00 2001 From: Daniel Freire Date: Thu, 30 Mar 2023 19:57:59 -0300 Subject: [PATCH 2/6] Added ARJ fixture --- fixture/fixture.arj | Bin 0 -> 124 bytes package.json | 3 ++- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 fixture/fixture.arj 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 0ef844ae..432828fe 100644 --- a/package.json +++ b/package.json @@ -197,7 +197,8 @@ "jls", "pst", "dwg", - "parquet" + "parquet", + "arj" ], "dependencies": { "readable-web-to-node-stream": "^3.0.2", From f42ebd6ab09acf9fb963ab54a55a86b8d0e3c98c Mon Sep 17 00:00:00 2001 From: Daniel Freire Date: Thu, 30 Mar 2023 20:05:59 -0300 Subject: [PATCH 3/6] Added ARJ mime to MimeType and mimeTypes --- core.d.ts | 3 ++- supported.js | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/core.d.ts b/core.d.ts index b20a308f..a0099844 100644 --- a/core.d.ts +++ b/core.d.ts @@ -285,7 +285,8 @@ export type MimeType = | 'image/jls' | 'application/vnd.ms-outlook' | 'image/vnd.dwg' - | 'application/x-parquet'; + | 'application/x-parquet' + | 'application/x-arj'; export type FileTypeResult = { /** diff --git a/supported.js b/supported.js index 7a755e76..15bc42cf 100644 --- a/supported.js +++ b/supported.js @@ -284,4 +284,5 @@ export const mimeTypes = [ 'application/vnd.ms-outlook', 'image/vnd.dwg', 'application/x-parquet', + 'application/x-arj', ]; From 82d2f30483c25a88e86f8ae307a5e13206614d3b Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Sun, 23 Apr 2023 15:55:14 +0800 Subject: [PATCH 4/6] Update core.d.ts --- core.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core.d.ts b/core.d.ts index 4410fc5d..032533fc 100644 --- a/core.d.ts +++ b/core.d.ts @@ -146,7 +146,7 @@ export type FileExtension = | 'dwg' | 'parquet' | 'class' - | 'arj' + | 'arj' ; // eslint-disable-line semi-style export type MimeType = @@ -289,7 +289,7 @@ export type MimeType = | 'image/vnd.dwg' | 'application/x-parquet' | 'application/java-vm' - | 'application/x-arj' + | 'application/x-arj' ; // eslint-disable-line semi-style export type FileTypeResult = { From 149c3c24e23bba134891093bfe6a282d2bb7974d Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Sun, 23 Apr 2023 15:55:32 +0800 Subject: [PATCH 5/6] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b0651570..37d5887b 100644 --- a/package.json +++ b/package.json @@ -199,7 +199,7 @@ "dwg", "parquet", "class", - "arj" + "arj" ], "dependencies": { "readable-web-to-node-stream": "^3.0.2", From 2fc6346ccef9410851eaae07dd30d17323a2a770 Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Sun, 23 Apr 2023 15:55:59 +0800 Subject: [PATCH 6/6] Update supported.js --- supported.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/supported.js b/supported.js index df835a04..10481f89 100644 --- a/supported.js +++ b/supported.js @@ -143,7 +143,7 @@ export const extensions = [ 'dwg', 'parquet', 'class', - 'arj', + 'arj', ]; export const mimeTypes = [ @@ -286,5 +286,5 @@ export const mimeTypes = [ 'image/vnd.dwg', 'application/x-parquet', 'application/java-vm', - 'application/x-arj', + 'application/x-arj', ];