mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-06 15:57:13 +00:00
Merge pull request #17088 from joeldn/master
mime: add fallback param to lookup function definition
This commit is contained in:
Vendored
+9
-8
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user