diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 0000000..ac714c8 --- /dev/null +++ b/index.d.ts @@ -0,0 +1,46 @@ +/** + * Get the default charset for a MIME type. + * + * @param {string} mimeType MIME type + * @return {string|boolean} the default charset or false if not found + */ +export function charset (mimeType: string): string + +/** + * Create a full Content-Type header given a MIME type or extension. + * + * @param {string} type MIME type or extension + * @return {boolean|string} Content-Type header + */ +export function contentType (type: string): string + +/** + * Get the default extension for a MIME type. + * + * @param {string} mimeType MIME type + * @return {boolean|string} the extension or false if not found + */ +export function extension (mimeType: string): string + +/** + * Lookup the MIME type for a file path/extension. + * + * @param {string} path + * @return {string|boolean} MIME type, or false if not found + */ +export function lookup (path: string): string + +/** + * charsets.lookup redirects to lookup + */ +export var charsets: {lookup: (mimeType: string) => string} + +/** + * File extensions indexed by MIME type + */ +export var extensions: { [extension: string]: string }; + +/** + * MIME types indexed by (lower case) file extension + */ +export var types: { [contentType: string]: string }; \ No newline at end of file diff --git a/package.json b/package.json index c545098..e401722 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,8 @@ "files": [ "HISTORY.md", "LICENSE", - "index.js" + "index.js", + "index.d.ts" ], "engines": { "node": ">= 0.6"