本文整理汇总了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');