Skip to content

Commit

Permalink
Add support for ACE (#592)
Browse files Browse the repository at this point in the history
  • Loading branch information
dcfreire committed Apr 25, 2023
1 parent f84e96c commit 1899fc1
Show file tree
Hide file tree
Showing 6 changed files with 17 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 @@ -148,6 +148,7 @@ export type FileExtension =
| 'class'
| 'arj'
| 'cpio'
| 'ace'
; // eslint-disable-line semi-style

export type MimeType =
Expand Down Expand Up @@ -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 = {
Expand Down
10 changes: 10 additions & 0 deletions core.js
Original file line number Diff line number Diff line change
Expand Up @@ -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])) {
Expand Down
Binary file added fixture/fixture.ace
Binary file not shown.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,8 @@
"parquet",
"class",
"arj",
"cpio"
"cpio",
"ace"
],
"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 @@ -344,6 +344,7 @@ Returns a `Set<string>` 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
Expand Down
2 changes: 2 additions & 0 deletions supported.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ export const extensions = [
'class',
'arj',
'cpio',
'ace',
];

export const mimeTypes = [
Expand Down Expand Up @@ -289,4 +290,5 @@ export const mimeTypes = [
'application/java-vm',
'application/x-arj',
'application/x-cpio',
'application/x-ace-compressed',
];

0 comments on commit 1899fc1

Please sign in to comment.