content-type.d.ts 561 B

123456789101112131415161718192021
  1. /// <reference types="node" />
  2. interface MIMEType {
  3. type: string
  4. subtype: string
  5. parameters: Map<string, string>
  6. essence: string
  7. }
  8. /**
  9. * Parse a string to a {@link MIMEType} object. Returns `failure` if the string
  10. * couldn't be parsed.
  11. * @see https://mimesniff.spec.whatwg.org/#parse-a-mime-type
  12. */
  13. export function parseMIMEType (input: string): 'failure' | MIMEType
  14. /**
  15. * Convert a MIMEType object to a string.
  16. * @see https://mimesniff.spec.whatwg.org/#serialize-a-mime-type
  17. */
  18. export function serializeAMimeType (mimeType: MIMEType): string