filestack-js 3.30.2 → 3.32.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/CHANGELOG.md +11 -0
- package/build/browser/filestack.esm.js +2 -2
- package/build/browser/filestack.esm.js.map +1 -1
- package/build/browser/filestack.min.js +2 -2
- package/build/browser/filestack.min.js.map +1 -1
- package/build/browser/filestack.umd.js +2 -2
- package/build/browser/filestack.umd.js.map +1 -1
- package/build/browser/manifest.json +2 -2
- package/build/main/config.js +2 -2
- package/build/main/index.d.ts +1 -1
- package/build/main/index.js +2 -2
- package/build/main/lib/utils/extensions.js +2 -1
- package/build/main/lib/utils/index.browser.js +1 -1
- package/build/main/lib/utils/index.js +2 -2
- package/build/main/lib/utils/index.node.js +1 -1
- package/build/main/lib/utils/index.spec.browser.js +1 -1
- package/build/module/config.js +2 -2
- package/build/module/index.d.ts +1 -1
- package/build/module/index.js +2 -2
- package/build/module/lib/utils/extensions.js +2 -1
- package/build/module/lib/utils/index.browser.js +1 -1
- package/build/module/lib/utils/index.js +2 -2
- package/build/module/lib/utils/index.node.js +1 -1
- package/build/module/lib/utils/index.spec.browser.js +1 -1
- package/package.json +2 -1
- package/src/config.ts +1 -1
- package/src/lib/utils/extensions.ts +1 -0
- package/src/lib/utils/index.ts +4 -0
package/src/lib/utils/index.ts
CHANGED
|
@@ -103,11 +103,13 @@ export const uniqueId = (len: number = 10): string => {
|
|
|
103
103
|
*/
|
|
104
104
|
export const getMimetype = async(file: Uint8Array | Buffer, name?: string): Promise<string> => {
|
|
105
105
|
let type;
|
|
106
|
+
|
|
106
107
|
try {
|
|
107
108
|
type = await fromBuffer(file);
|
|
108
109
|
} catch(e) {
|
|
109
110
|
console.warn("An exception occurred while processing the buffer:", e.message);
|
|
110
111
|
}
|
|
112
|
+
|
|
111
113
|
if (name && name.indexOf('.') > -1) {
|
|
112
114
|
const mime = extensionToMime(name);
|
|
113
115
|
|
|
@@ -115,6 +117,7 @@ export const getMimetype = async(file: Uint8Array | Buffer, name?: string): Prom
|
|
|
115
117
|
return mime;
|
|
116
118
|
}
|
|
117
119
|
}
|
|
120
|
+
|
|
118
121
|
const excludedMimetypes = ['text/plain', 'application/octet-stream', 'application/x-ms', 'application/x-msi', 'application/zip'];
|
|
119
122
|
|
|
120
123
|
if (type && excludedMimetypes.indexOf(type.mime) === -1) {
|
|
@@ -137,6 +140,7 @@ export const getMimetype = async(file: Uint8Array | Buffer, name?: string): Prom
|
|
|
137
140
|
return type.mime;
|
|
138
141
|
}
|
|
139
142
|
|
|
143
|
+
return 'application/octet-stream';
|
|
140
144
|
};
|
|
141
145
|
|
|
142
146
|
/**
|