file-type 20.4.0 → 20.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core.d.ts +5 -0
- package/core.js +22 -12
- package/package.json +4 -2
- package/readme.md +2 -0
- package/supported.js +9 -5
package/core.d.ts
CHANGED
|
@@ -194,6 +194,11 @@ export type AnyWebReadableByteStreamWithFileType = AnyWebReadableStream<Uint8Arr
|
|
|
194
194
|
readonly fileType?: FileTypeResult;
|
|
195
195
|
};
|
|
196
196
|
|
|
197
|
+
/**
|
|
198
|
+
Workaround for using `bundler` as the module-resolution in TypeScript.
|
|
199
|
+
*/
|
|
200
|
+
export function fileTypeFromFile(filePath: string, options?: {customDetectors?: Iterable<Detector>}): Promise<FileTypeResult | undefined>;
|
|
201
|
+
|
|
197
202
|
/**
|
|
198
203
|
Returns a `Promise` which resolves to the original readable stream argument, but with an added `fileType` property, which is an object like the one returned from `fileTypeFromFile()`.
|
|
199
204
|
|
package/core.js
CHANGED
|
@@ -28,7 +28,7 @@ export async function fileTypeFromBlob(blob) {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
function getFileTypeFromMimeType(mimeType) {
|
|
31
|
-
switch (mimeType) {
|
|
31
|
+
switch (mimeType.toLowerCase()) {
|
|
32
32
|
case 'application/epub+zip':
|
|
33
33
|
return {
|
|
34
34
|
ext: 'epub',
|
|
@@ -74,65 +74,75 @@ function getFileTypeFromMimeType(mimeType) {
|
|
|
74
74
|
ext: 'otg',
|
|
75
75
|
mime: 'application/vnd.oasis.opendocument.graphics-template',
|
|
76
76
|
};
|
|
77
|
+
case 'application/vnd.openxmlformats-officedocument.presentationml.slideshow':
|
|
78
|
+
return {
|
|
79
|
+
ext: 'ppsx',
|
|
80
|
+
mime: 'application/vnd.openxmlformats-officedocument.presentationml.slideshow',
|
|
81
|
+
};
|
|
77
82
|
case 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet':
|
|
78
83
|
return {
|
|
79
84
|
ext: 'xlsx',
|
|
80
85
|
mime: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
81
86
|
};
|
|
82
|
-
case 'application/vnd.ms-excel.sheet.
|
|
87
|
+
case 'application/vnd.ms-excel.sheet.macroenabled':
|
|
83
88
|
return {
|
|
84
89
|
ext: 'xlsm',
|
|
85
|
-
mime: 'application/vnd.ms-excel.sheet.
|
|
90
|
+
mime: 'application/vnd.ms-excel.sheet.macroenabled.12',
|
|
86
91
|
};
|
|
87
92
|
case 'application/vnd.openxmlformats-officedocument.spreadsheetml.template':
|
|
88
93
|
return {
|
|
89
94
|
ext: 'xltx',
|
|
90
95
|
mime: 'application/vnd.openxmlformats-officedocument.spreadsheetml.template',
|
|
91
96
|
};
|
|
92
|
-
case 'application/vnd.ms-excel.template.
|
|
97
|
+
case 'application/vnd.ms-excel.template.macroenabled':
|
|
93
98
|
return {
|
|
94
99
|
ext: 'xltm',
|
|
95
100
|
mime: 'application/vnd.ms-excel.template.macroenabled.12',
|
|
96
101
|
};
|
|
102
|
+
case 'application/vnd.ms-powerpoint.slideshow.macroenabled':
|
|
103
|
+
return {
|
|
104
|
+
ext: 'ppsm',
|
|
105
|
+
mime: 'application/vnd.ms-powerpoint.slideshow.macroenabled.12',
|
|
106
|
+
};
|
|
97
107
|
case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document':
|
|
98
108
|
return {
|
|
99
109
|
ext: 'docx',
|
|
100
110
|
mime: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
101
111
|
};
|
|
102
|
-
case 'application/vnd.ms-word.document.
|
|
112
|
+
case 'application/vnd.ms-word.document.macroenabled':
|
|
103
113
|
return {
|
|
104
114
|
ext: 'docm',
|
|
105
|
-
mime: 'application/vnd.ms-word.document.
|
|
115
|
+
mime: 'application/vnd.ms-word.document.macroenabled.12',
|
|
106
116
|
};
|
|
107
117
|
case 'application/vnd.openxmlformats-officedocument.wordprocessingml.template':
|
|
108
118
|
return {
|
|
109
119
|
ext: 'dotx',
|
|
110
120
|
mime: 'application/vnd.openxmlformats-officedocument.wordprocessingml.template',
|
|
111
121
|
};
|
|
112
|
-
case 'application/vnd.ms-word.template.
|
|
122
|
+
case 'application/vnd.ms-word.template.macroenabledtemplate':
|
|
113
123
|
return {
|
|
114
124
|
ext: 'dotm',
|
|
115
|
-
mime: 'application/vnd.ms-word.template.
|
|
125
|
+
mime: 'application/vnd.ms-word.template.macroenabled.12',
|
|
116
126
|
};
|
|
117
127
|
case 'application/vnd.openxmlformats-officedocument.presentationml.template':
|
|
118
128
|
return {
|
|
119
129
|
ext: 'potx',
|
|
120
130
|
mime: 'application/vnd.openxmlformats-officedocument.presentationml.template',
|
|
121
131
|
};
|
|
122
|
-
case 'application/vnd.ms-powerpoint.template.
|
|
132
|
+
case 'application/vnd.ms-powerpoint.template.macroenabled':
|
|
123
133
|
return {
|
|
124
134
|
ext: 'potm',
|
|
125
|
-
mime: 'application/vnd.ms-powerpoint.template.
|
|
135
|
+
mime: 'application/vnd.ms-powerpoint.template.macroenabled.12',
|
|
126
136
|
};
|
|
127
137
|
case 'application/vnd.openxmlformats-officedocument.presentationml.presentation':
|
|
128
138
|
return {
|
|
129
139
|
ext: 'pptx',
|
|
130
140
|
mime: 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
|
131
141
|
};
|
|
132
|
-
case 'application/vnd.ms-powerpoint.presentation.
|
|
142
|
+
case 'application/vnd.ms-powerpoint.presentation.macroenabled':
|
|
133
143
|
return {
|
|
134
144
|
ext: 'pptm',
|
|
135
|
-
mime: 'application/vnd.ms-powerpoint.presentation.
|
|
145
|
+
mime: 'application/vnd.ms-powerpoint.presentation.macroenabled.12',
|
|
136
146
|
};
|
|
137
147
|
case 'application/vnd.ms-visio.drawing':
|
|
138
148
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "file-type",
|
|
3
|
-
"version": "20.
|
|
3
|
+
"version": "20.5.0",
|
|
4
4
|
"description": "Detect the file type of a file, stream, or data",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "sindresorhus/file-type",
|
|
@@ -242,7 +242,9 @@
|
|
|
242
242
|
"potm",
|
|
243
243
|
"pptm",
|
|
244
244
|
"jar",
|
|
245
|
-
"rm"
|
|
245
|
+
"rm",
|
|
246
|
+
"ppsm",
|
|
247
|
+
"ppsx"
|
|
246
248
|
],
|
|
247
249
|
"dependencies": {
|
|
248
250
|
"@tokenizer/inflate": "^0.2.6",
|
package/readme.md
CHANGED
|
@@ -557,6 +557,8 @@ abortController.abort(); // Abort file-type reading from the Blob stream.
|
|
|
557
557
|
- [`png`](https://en.wikipedia.org/wiki/Portable_Network_Graphics) - Portable Network Graphics
|
|
558
558
|
- [`potm`](https://en.wikipedia.org/wiki/List_of_Microsoft_Office_filename_extensions) - Microsoft PowerPoint macro-enabled template
|
|
559
559
|
- [`potx`](https://en.wikipedia.org/wiki/List_of_Microsoft_Office_filename_extensions) - Microsoft PowerPoint template
|
|
560
|
+
- [`ppsm`](https://en.wikipedia.org/wiki/List_of_Microsoft_Office_filename_extensions#PowerPoint) - Office PowerPoint 2007 macro-enabled slide show
|
|
561
|
+
- [`ppsx`](https://en.wikipedia.org/wiki/List_of_Microsoft_Office_filename_extensions#PowerPoint) - Office PowerPoint 2007 slide show
|
|
560
562
|
- [`pptm`](https://en.wikipedia.org/wiki/List_of_Microsoft_Office_filename_extensions) - Microsoft PowerPoint macro-enabled document
|
|
561
563
|
- [`pptx`](https://en.wikipedia.org/wiki/Office_Open_XML) - Microsoft PowerPoint document
|
|
562
564
|
- [`ps`](https://en.wikipedia.org/wiki/Postscript) - Postscript
|
package/supported.js
CHANGED
|
@@ -173,6 +173,8 @@ export const extensions = [
|
|
|
173
173
|
'pptm',
|
|
174
174
|
'jar',
|
|
175
175
|
'rm',
|
|
176
|
+
'ppsm',
|
|
177
|
+
'ppsx',
|
|
176
178
|
];
|
|
177
179
|
|
|
178
180
|
export const mimeTypes = [
|
|
@@ -191,12 +193,14 @@ export const mimeTypes = [
|
|
|
191
193
|
'application/x-indesign',
|
|
192
194
|
'application/epub+zip',
|
|
193
195
|
'application/x-xpinstall',
|
|
196
|
+
'application/vnd.ms-powerpoint.slideshow.macroenabled.12',
|
|
194
197
|
'application/vnd.oasis.opendocument.text',
|
|
195
198
|
'application/vnd.oasis.opendocument.spreadsheet',
|
|
196
199
|
'application/vnd.oasis.opendocument.presentation',
|
|
197
200
|
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
198
201
|
'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
|
199
202
|
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
203
|
+
'application/vnd.openxmlformats-officedocument.presentationml.slideshow',
|
|
200
204
|
'application/zip',
|
|
201
205
|
'application/x-tar',
|
|
202
206
|
'application/x-rar-compressed',
|
|
@@ -338,11 +342,11 @@ export const mimeTypes = [
|
|
|
338
342
|
'application/vnd.oasis.opendocument.presentation-template',
|
|
339
343
|
'application/vnd.oasis.opendocument.graphics',
|
|
340
344
|
'application/vnd.oasis.opendocument.graphics-template',
|
|
341
|
-
'application/vnd.ms-excel.sheet.
|
|
342
|
-
'application/vnd.ms-word.document.
|
|
343
|
-
'application/vnd.ms-word.template.
|
|
344
|
-
'application/vnd.ms-powerpoint.template.
|
|
345
|
-
'application/vnd.ms-powerpoint.presentation.
|
|
345
|
+
'application/vnd.ms-excel.sheet.macroenabled.12',
|
|
346
|
+
'application/vnd.ms-word.document.macroenabled.12',
|
|
347
|
+
'application/vnd.ms-word.template.macroenabled.12',
|
|
348
|
+
'application/vnd.ms-powerpoint.template.macroenabled.12',
|
|
349
|
+
'application/vnd.ms-powerpoint.presentation.macroenabled.12',
|
|
346
350
|
'application/java-archive',
|
|
347
351
|
'application/vnd.rn-realmedia',
|
|
348
352
|
];
|