mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-05 15:27:05 +00:00
add types for mime-types 2.1.15
This commit is contained in:
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
// Type definitions for mime-types 2.1
|
||||
// Project: https://github.com/jshttp/mime-types#readme
|
||||
// Definitions by: Gyusun Yeom <https://github.com/Perlmint>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export function lookup(filenameOrExt: string): string | false;
|
||||
export function contentType(filenameOrExt: string): string | false;
|
||||
export function extension(typeString: string): string | false;
|
||||
export function charset(typeString: string): string | false;
|
||||
export const types: {[key: string]: string};
|
||||
export const extensions: {[key: string]: string[]};
|
||||
@@ -0,0 +1,18 @@
|
||||
import * as mime from 'mime-types';
|
||||
|
||||
mime.lookup('json'); // 'application/json'
|
||||
mime.lookup('.md'); // 'text/x-markdown'
|
||||
mime.lookup('file.html'); // 'text/html'
|
||||
mime.lookup('folder/file.js'); // 'application/javascript'
|
||||
mime.lookup('folder/.htaccess'); // false
|
||||
|
||||
mime.lookup('cats'); // false
|
||||
mime.contentType('markdown'); // 'text/x-markdown; charset=utf-8'
|
||||
mime.contentType('file.json'); // 'application/json; charset=utf-8'
|
||||
|
||||
// from a full path
|
||||
mime.contentType('.json'); // 'application/json; charset=utf-8'
|
||||
|
||||
mime.extension('application/octet-stream'); // 'bin'
|
||||
|
||||
mime.charset('text/x-markdown'); // 'UTF-8'
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"mime-types-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
Reference in New Issue
Block a user