Dev Build / cleanup (push) Canceled after 0s
Dev Build / typecheck (push) Canceled after 0s
Dev Build / build (linux-arm64, ubuntu-24.04-arm, linux-arm64) (push) Canceled after 0s
Dev Build / build (linux-x64, ubuntu-latest, linux-x64) (push) Canceled after 0s
Dev Build / build (win-x64, windows-latest, win32-x64) (push) Canceled after 0s
Dev Build / dispatch-dev-docker (push) Canceled after 0s
47 lines
1.1 KiB
Plaintext
47 lines
1.1 KiB
Plaintext
/*!
|
|
* content-type
|
|
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
* MIT Licensed
|
|
*/
|
|
/**
|
|
* The content type object contains a type string and optional parameters.
|
|
*/
|
|
export interface ContentType {
|
|
type: string;
|
|
index: number;
|
|
parameters: Record<string, string>;
|
|
}
|
|
/**
|
|
* Format an object into a `Content-Type` header.
|
|
*/
|
|
export declare function format(obj: Partial<ContentType>): string;
|
|
/**
|
|
* Options for parsing a `Content-Type` header.
|
|
*/
|
|
export interface ParseOptions {
|
|
/**
|
|
* Exit early on the first semicolon, returning only the type.
|
|
* This is useful for parsing the MIME from `Content-Type` headers.
|
|
*
|
|
* @default false
|
|
*/
|
|
parameters?: boolean;
|
|
/**
|
|
* Exits early on a comma, returning the first value and parameters.
|
|
* This is useful for parsing `Accept` headers.
|
|
*
|
|
* @default false
|
|
*/
|
|
comma?: boolean;
|
|
/**
|
|
* The index to start parsing from.
|
|
*
|
|
* @default 0
|
|
*/
|
|
start?: number;
|
|
}
|
|
/**
|
|
* Parse a `Content-Type` header.
|
|
*/
|
|
export declare function parse(header: string, options?: ParseOptions): ContentType;
|