Skip to content

Commit

Permalink
Add support for Avro (#597)
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorWiecz committed May 10, 2023
1 parent 1978fc6 commit 34ab7d4
Show file tree
Hide file tree
Showing 6 changed files with 14 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 @@ -150,6 +150,7 @@ export type FileExtension =
| 'arj'
| 'cpio'
| 'ace'
| 'avro'
; // eslint-disable-line semi-style

export type MimeType =
Expand Down Expand Up @@ -296,6 +297,7 @@ export type MimeType =
| 'application/x-arj'
| 'application/x-cpio'
| 'application/x-ace-compressed'
| 'application/avro'
; // eslint-disable-line semi-style

export type FileTypeResult = {
Expand Down
7 changes: 7 additions & 0 deletions core.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,13 @@ class FileTypeParser {
};
}

if (this.check([0x4F, 0x62, 0x6A, 0x01])) {
return {
ext: 'avro',
mime: 'application/avro',
};
}

if (this.checkString('FLIF')) {
return {
ext: 'flif',
Expand Down
Binary file added fixture/fixture.avro
Binary file not shown.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,8 @@
"class",
"arj",
"cpio",
"ace"
"ace",
"avro"
],
"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 @@ -359,6 +359,7 @@ Returns a `Set<string>` of supported MIME types.
- [`asf`](https://en.wikipedia.org/wiki/Advanced_Systems_Format) - Advanced Systems Format
- [`avi`](https://en.wikipedia.org/wiki/Audio_Video_Interleave) - Audio Video Interleave file
- [`avif`](https://en.wikipedia.org/wiki/AV1#AV1_Image_File_Format_(AVIF)) - AV1 Image File Format
- [`avro`](https://en.wikipedia.org/wiki/Apache_Avro#Avro_Object_Container_File) - Object container file developed by Apache Avro
- [`blend`](https://wiki.blender.org/index.php/Dev:Source/Architecture/File_Format) - Blender project
- [`bmp`](https://en.wikipedia.org/wiki/BMP_file_format) - Bitmap image file
- [`bpg`](https://bellard.org/bpg/) - Better Portable Graphics file
Expand Down
2 changes: 2 additions & 0 deletions supported.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ export const extensions = [
'arj',
'cpio',
'ace',
'avro',
];

export const mimeTypes = [
Expand Down Expand Up @@ -293,4 +294,5 @@ export const mimeTypes = [
'application/x-arj',
'application/x-cpio',
'application/x-ace-compressed',
'application/avro',
];

0 comments on commit 34ab7d4

Please sign in to comment.