From 86518094a97695eaa76eb768758ae51b28c8a074 Mon Sep 17 00:00:00 2001 From: Sylvain Mina Date: Fri, 10 Jan 2025 10:49:33 +0100 Subject: [PATCH] Add support for Java archive (`.jar`) (#719) --- core.js | 8 ++++++++ fixture/fixture.jar | Bin 0 -> 2559 bytes package.json | 3 ++- readme.md | 1 + supported.js | 2 ++ 5 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 fixture/fixture.jar diff --git a/core.js b/core.js index e349edea..73f6a7b3 100644 --- a/core.js +++ b/core.js @@ -519,6 +519,14 @@ export class FileTypeParser { return { stop: true, }; + case 'META-INF/MANIFEST.MF': + fileType = { + ext: 'jar', + mime: 'application/java-archive', + }; + return { + stop: true, + }; case 'mimetype': return { async handler(fileData) { diff --git a/fixture/fixture.jar b/fixture/fixture.jar new file mode 100644 index 0000000000000000000000000000000000000000..948b2ea5ec61b5588fdd472a736f213b39ec293a GIT binary patch literal 2559 zcmZ{mcT^L|7RIBY6U#~#6m+Fa4My7iJ=)Ff<&bnDS-eIKx#lrXi685vP6v1 zK}2a%1VuCi2uM+kVj!R)fYMgr!JfCS`_6gaoO|ZZ%>C}%KYx~Jpa2*kA|e9N!mHQ= zev&9a0Dv*Vp3yWjH`dzd0RVsiOSG`acE!&BmRbH^GkB}whZ%Fm+|1bM92SBxUc~gi zJd4(ZFn6If)n4~9YOS>gq3=JDASjH68HO2fUqCE-=D_p;)hl|o85|V>JISmPj^wNg znWHpISRl=lcKkI&Y;o=h1C~shv3Km`yTM_P49j{Bmhu%3NWRxS4d=0Tttj7DlR5s zSkx}hS8(D}gxRQASEb~_43@=KV2}IH3rQbIdT7G}eevyT#f`ohy#$JT-MQGxF83-s zZK(p@O;JyXSG6b53Fp@t>|;P}1VH%xQ`!Ab1%Z*5WnX((@-~vk3tM-7hsr{Cfb#)_L=lW=#)%> zVGsyt4y4ZIQ4+NJyn@!v6`blht@}XEAWzK|=SlHfRzq`HHmZBsYux$KYLU>|=E3x5 z&cXdaeKo6E(L$IvE($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2o2_*59%+F ztS)&v5&WuHn?Ah0?`*Pm+Vub{BK>xlsEvdk?YDGP1Yr%EsxsTCQZakcJeW}d+!8_f8a2J+yH zK&v8!DLo;v%kkFRF@s#+gPQtEM%Pxlc$MI?bQs~l!K%i#59Lqk!G=SUK`0|iufd?S^#vQ#EM{6YX z^F39%SNVIk!N=XhZ4|ME6wkN961`(581Qdy`WuS2x#{2f0Ycjp^}p7iQD&Q({tbLjXXaO_7|T0Xwklv{S82tXhEUv2jJGK-P%uxZlC@Gsi<>q literal 0 HcmV?d00001 diff --git a/package.json b/package.json index 59101399..8dced6ed 100644 --- a/package.json +++ b/package.json @@ -233,7 +233,8 @@ "docm", "dotm", "potm", - "pptm" + "pptm", + "jar" ], "dependencies": { "@tokenizer/inflate": "^0.2.6", diff --git a/readme.md b/readme.md index 9cb86064..5c22f3f9 100644 --- a/readme.md +++ b/readme.md @@ -484,6 +484,7 @@ abortController.abort(); // Abort file-type reading from the Blob stream. - [`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 +- [`jar`](https://en.wikipedia.org/wiki/JAR_(file_format)) - Java archive - [`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 diff --git a/supported.js b/supported.js index ed98dac6..54d6dcd3 100644 --- a/supported.js +++ b/supported.js @@ -170,6 +170,7 @@ export const extensions = [ 'dotm', 'potm', 'pptm', + 'jar', ]; export const mimeTypes = [ @@ -339,4 +340,5 @@ export const mimeTypes = [ 'application/vnd.ms-word.template.macroEnabled.12', 'application/vnd.ms-powerpoint.template.macroEnabled.12', 'application/vnd.ms-powerpoint.presentation.macroEnabled.12', + 'application/java-archive', ];