From 1899fc123405bb9f29f270da66f1ba8ae6bae4c0 Mon Sep 17 00:00:00 2001 From: Daniel Freire Date: Tue, 25 Apr 2023 02:30:51 -0300 Subject: [PATCH] Add support for ACE (#592) --- core.d.ts | 2 ++ core.js | 10 ++++++++++ fixture/fixture.ace | Bin 0 -> 97 bytes package.json | 3 ++- readme.md | 1 + supported.js | 2 ++ 6 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 fixture/fixture.ace diff --git a/core.d.ts b/core.d.ts index 1b340fb1..9dcf2299 100644 --- a/core.d.ts +++ b/core.d.ts @@ -148,6 +148,7 @@ export type FileExtension = | 'class' | 'arj' | 'cpio' + | 'ace' ; // eslint-disable-line semi-style export type MimeType = @@ -292,6 +293,7 @@ export type MimeType = | 'application/java-vm' | 'application/x-arj' | 'application/x-cpio' + | 'application/x-ace-compressed' ; // eslint-disable-line semi-style export type FileTypeResult = { diff --git a/core.js b/core.js index e2c94e7b..2df59ae6 100644 --- a/core.js +++ b/core.js @@ -1020,6 +1020,16 @@ class FileTypeParser { }; } + if (this.checkString('**ACE', {offset: 7})) { + await tokenizer.peekBuffer(this.buffer, {length: 14, mayBeLess: true}); + if (this.checkString('**', {offset: 12})) { + return { + ext: 'ace', + mime: 'application/x-ace-compressed', + }; + } + } + // -- 8-byte signatures -- if (this.check([0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A])) { diff --git a/fixture/fixture.ace b/fixture/fixture.ace new file mode 100644 index 0000000000000000000000000000000000000000..92ab1e5b8113fbfbd32e72f9f4893994b51f771c GIT binary patch literal 97 zcmZ4T-;jZUVS<*HqqD1)mWT)w!^s)-VSeYguK)@&h-roT1-ZI=28Xx?xwAYfqTVhC~NWJt{|D5=ydsVD&e8X_Aw literal 0 HcmV?d00001 diff --git a/package.json b/package.json index 0b390b06..83f90021 100644 --- a/package.json +++ b/package.json @@ -200,7 +200,8 @@ "parquet", "class", "arj", - "cpio" + "cpio", + "ace" ], "dependencies": { "readable-web-to-node-stream": "^3.0.2", diff --git a/readme.md b/readme.md index 3ae0cb9d..a80f377e 100644 --- a/readme.md +++ b/readme.md @@ -344,6 +344,7 @@ Returns a `Set` of supported MIME types. - [`Z`](https://fileinfo.com/extension/z) - Unix Compressed File - [`aac`](https://en.wikipedia.org/wiki/Advanced_Audio_Coding) - Advanced Audio Coding - [`ac3`](https://www.atsc.org/standard/a522012-digital-audio-compression-ac-3-e-ac-3-standard-12172012/) - ATSC A/52 Audio File +- [`ace`](https://en.wikipedia.org/wiki/ACE_(compressed_file_format)) - ACE archive - [`ai`](https://en.wikipedia.org/wiki/Adobe_Illustrator_Artwork) - Adobe Illustrator Artwork - [`aif`](https://en.wikipedia.org/wiki/Audio_Interchange_File_Format) - Audio Interchange file - [`alias`](https://en.wikipedia.org/wiki/Alias_%28Mac_OS%29) - macOS Alias file diff --git a/supported.js b/supported.js index 083c9363..4b7f41d8 100644 --- a/supported.js +++ b/supported.js @@ -145,6 +145,7 @@ export const extensions = [ 'class', 'arj', 'cpio', + 'ace', ]; export const mimeTypes = [ @@ -289,4 +290,5 @@ export const mimeTypes = [ 'application/java-vm', 'application/x-arj', 'application/x-cpio', + 'application/x-ace-compressed', ];