本文整理匯總了TypeScript中mime.define函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript define函數的具體用法?TypeScript define怎麽用?TypeScript define使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了define函數的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1:
import * as mime from "mime";
let str: string;
const obj: {} = {};
const fallback = '';
str = mime.lookup(str, fallback);
str = mime.extension(str);
mime.load(str);
mime.define(obj);
str = mime.charsets.lookup(str);
示例2: Mime
import * as mime from "mime";
import Mime from "mime/Mime";
let strOrNul: string | null;
const obj = {
mime: ["ext", "ext2"]
};
const obj2 = {
"text/plain": ["txt"]
};
mime.define(obj);
mime.define(obj2, true);
strOrNul = mime.getType("ext");
strOrNul = mime.getType("foo");
strOrNul = mime.getExtension("mime");
strOrNul = mime.getExtension("bar");
const myMime = new Mime(obj);
strOrNul = myMime.getType("foo");
strOrNul = myMime.getExtension('text/plan');