update file shim to use detectFileType.

This commit is contained in:
d98762625 2019-03-20 12:38:49 +00:00
parent 4add484d2a
commit aad1bc898e
4 changed files with 25 additions and 4 deletions

View file

@ -5,6 +5,8 @@
*/
import mime from "mime";
import { detectFileType } from "../core/lib/FileType";
/**
* FileShim
@ -37,8 +39,13 @@ class File {
this.name = name;
this.lastModified = stats.lastModified || Date.now();
this.type = stats.type || mime.getType(this.name);
const types = detectFileType(this.data);
if (types.length) {
this.type = types[0].mime;
} else {
this.type = "application/unknown";
}
}
/**