-
-
Notifications
You must be signed in to change notification settings - Fork 352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
avro file type support added #597
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ import type {Readable as ReadableStream} from 'node:stream'; | |
import type {ITokenizer} from 'strtok3'; | ||
|
||
export type FileExtension = | ||
| 'avro' | ||
| 'jpg' | ||
| 'png' | ||
| 'apng' | ||
|
@@ -167,6 +168,7 @@ export type MimeType = | |
| 'image/vnd.ms-photo' | ||
| 'image/vnd.adobe.photoshop' | ||
| 'application/x-indesign' | ||
| 'application/avro' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be added to the end. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
| 'application/epub+zip' | ||
| 'application/x-xpinstall' | ||
| 'application/vnd.oasis.opendocument.text' | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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', | ||
|
@@ -292,6 +299,13 @@ class FileTypeParser { | |
}; | ||
} | ||
|
||
if (this.checkString('avro')) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you link to a source for this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see it written anywhere there that the file header must start with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After further research I think you are correct, it is not specified anywhere that the file header MUST end with avro. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've also noticed people use .avsc and .acme, but I don't quite understand the difference |
||
return { | ||
ext: 'avro', | ||
mime: 'application/avro', | ||
}; | ||
} | ||
|
||
// Zip-based file formats | ||
// Need to be before the `zip` check | ||
if (this.check([0x50, 0x4B, 0x3, 0x4])) { // Local file header signature | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
export const extensions = [ | ||
'avro', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It was implied that #597 (comment) applied here too. And the below. |
||
'jpg', | ||
'png', | ||
'apng', | ||
|
@@ -162,6 +163,7 @@ export const mimeTypes = [ | |
'image/bmp', | ||
'image/vnd.ms-photo', | ||
'image/vnd.adobe.photoshop', | ||
'application/avro', | ||
'application/x-indesign', | ||
'application/epub+zip', | ||
'application/x-xpinstall', | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be added to the end.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.