mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
* rename the definition file of another `content-type` library * add the definition of `content-type` library
22 lines
519 B
TypeScript
22 lines
519 B
TypeScript
/// <reference path="content-type.d.ts" />
|
|
/// <reference path="../express/express.d.ts" />
|
|
|
|
import contentType = require('content-type');
|
|
import express = require('express');
|
|
|
|
|
|
var obj = contentType.parse('image/svg+xml; charset=utf-8');
|
|
|
|
console.log(obj.type); // => 'image/svg+xml'
|
|
console.log(obj.parameters.charset); // => 'utf-8'
|
|
|
|
|
|
var req: express.Request;
|
|
obj = contentType.parse(req);
|
|
|
|
var res: express.Response;
|
|
obj = contentType.parse(res);
|
|
|
|
var str: string = contentType.format({type: 'image/svg+xml'});
|
|
|