INNER CODE UNIT · TypeScript
isTextFile
WorldQL/dreamlab-engine · editor/client/main.ts:67
function isTextFile(mimeType: string): boolean {
const textTypes = [
"text/",
"application/json",
"application/javascript",
"application/xml",
"application/x-httpd-php",
];
return textTypes.some(type => mimeType.startsWith(type));
}
let content: string | ArrayBuffer;
if (typeof file === "string") {
content = file;
} else {
const isText = isTextFile(file.type);