WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions core.js
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ export class FileTypeParser {
if (this.checkString('LZIP')) {
return {
ext: 'lz',
mime: 'application/x-lzip',
mime: 'application/lzip',
};
}

Expand Down Expand Up @@ -943,7 +943,7 @@ export class FileTypeParser {
if (this.check([0x04, 0x22, 0x4D, 0x18])) {
return {
ext: 'lz4',
mime: 'application/x-lz4', // Invented by us
mime: 'application/x-lz4',
};
}

Expand Down Expand Up @@ -1056,7 +1056,7 @@ export class FileTypeParser {
if (this.checkString('DRACO')) {
return {
ext: 'drc',
mime: 'application/vnd.google.draco', // Invented by us
mime: 'application/x-ft-draco',
};
}

Expand Down Expand Up @@ -1616,21 +1616,21 @@ export class FileTypeParser {
if (this.check([0x4C, 0x00, 0x00, 0x00, 0x01, 0x14, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46])) {
return {
ext: 'lnk',
mime: 'application/x.ms.shortcut', // Invented by us
mime: 'application/x-ms-shortcut', // Informal, used by freedesktop.org. shared-mime-info
};
}

if (this.check([0x62, 0x6F, 0x6F, 0x6B, 0x00, 0x00, 0x00, 0x00, 0x6D, 0x61, 0x72, 0x6B, 0x00, 0x00, 0x00, 0x00])) {
return {
ext: 'alias',
mime: 'application/x.apple.alias', // Invented by us
mime: 'application/x-ft-apple.alias',
};
}

if (this.checkString('Kaydara FBX Binary \u0000')) {
return {
ext: 'fbx',
mime: 'application/x.autodesk.fbx', // Invented by us
mime: 'application/x-ft-fbx',
};
}

Expand Down
2 changes: 2 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ Returns a `Promise` for an object with the detected file type:
- `ext` - One of the [supported file types](#supported-file-types)
- `mime` - The [MIME type](https://en.wikipedia.org/wiki/Internet_media_type)

MIME media subtypes prefixed with `x-ft-` are custom and defined by us. They are neither formally registered with IANA nor based on any informal conventions.

Or `undefined` when there is no match.

#### buffer
Expand Down
15 changes: 9 additions & 6 deletions supported.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,9 @@ export const extensions = [
'dat',
];

/**
MIME media subtypes prefixed with `x-ft-` are custom and defined by us. They are neither formally registered with IANA nor based on any informal conventions.
*/
export const mimeTypes = [
'image/jpeg',
'image/png',
Expand Down Expand Up @@ -260,7 +263,7 @@ export const mimeTypes = [
'application/x-unix-archive',
'application/x-rpm',
'application/x-compress',
'application/x-lzip',
'application/lzip',
'application/x-cfb',
'application/x-mie',
'application/mxf',
Expand Down Expand Up @@ -288,9 +291,9 @@ export const mimeTypes = [
'text/vtt',
'model/gltf-binary',
'application/vnd.tcpdump.pcap',
'audio/x-dsf', // Non-standard
'application/x.ms.shortcut', // Invented by us
'application/x.apple.alias', // Invented by us
'audio/x-dsf', // Informal
'application/x-ms-shortcut', // Informal, used by freedesktop.org. shared-mime-info
'application/x-ft-apple.alias',
'audio/x-voc',
'audio/vnd.dolby.dd-raw',
'audio/x-m4a',
Expand Down Expand Up @@ -330,10 +333,10 @@ export const mimeTypes = [
'application/x-ace-compressed',
'application/avro',
'application/vnd.iccprofile',
'application/x.autodesk.fbx', // Invented by us
'application/x-ft-fbx',
'application/vnd.visio',
'application/vnd.android.package-archive',
'application/vnd.google.draco', // Invented by us
'application/x-ft-draco',
'application/x-lz4', // Invented by us
'application/vnd.openxmlformats-officedocument.presentationml.template',
'application/vnd.openxmlformats-officedocument.spreadsheetml.template',
Expand Down