Merge pull request #17088 from joeldn/master

mime: add fallback param to lookup function definition
This commit is contained in:
Mine Starks
2017-06-15 13:16:46 -07:00
committed by GitHub
4 changed files with 15 additions and 14 deletions
+9 -8
View File
@@ -1,19 +1,20 @@
// Type definitions for mime
// Type definitions for mime 1.3
// Project: https://github.com/broofa/node-mime
// Definitions by: Jeff Goddard <https://github.com/jedigo>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Imported from: https://github.com/soywiz/typescript-node-definitions/mime.d.ts
export as namespace mime;
export declare function lookup(path: string): string;
export declare function extension(mime: string): string;
export declare function load(filepath: string): void;
export declare function define(mimes: Object): void;
export function lookup(path: string, fallback: string): string;
export function extension(mime: string): string;
export function load(filepath: string): void;
export function define(mimes: { [key: string]: any }): void;
interface Charsets {
export interface Charsets {
lookup(mime: string): string;
}
export declare var charsets: Charsets;
export declare var default_type: string;
export const charsets: Charsets;
export const default_type: string;
+4 -4
View File
@@ -1,10 +1,10 @@
import * as mime from "mime";
var str: string;
var obj: Object;
let str: string;
const obj: {} = {};
const fallback: string = '';
str = mime.lookup(str);
str = mime.lookup(str, fallback);
str = mime.extension(str);
mime.load(str);
mime.define(obj);
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+1 -2
View File
@@ -5,7 +5,6 @@ import * as send from 'send';
var app = express();
send.mime.default_type = 'text/plain';
send.mime.define({
'application/x-my-type': ['x-mt', 'x-mtt']
});
@@ -34,4 +33,4 @@ app.get('/test.html', (req, res) => {
res.setHeader('Content-Disposition', 'attachment');
})
.pipe(res);
});
});