/ ai-anxieties-audio / node_modules / content-type /

[ICO]NameLast modifiedSizeDescription
[PARENTDIR]Parent Directory  -  
[TXT]HISTORY.md2 years ago523  
[   ]LICENSE2 years ago1.1Kf0d2fc9 test post-receive hook [كارل مبارك]
[TXT]README.md2 years ago2.7K15de0e0 styling, texts [كارل مبارك]
[   ]index.js2 years ago4.9K15de0e0 styling, texts [كارل مبارك]
[   ]package.json2 years ago1.0K120707f added node version q18.16 to dependincies [كارل مبارك]
README.md

content-type

NPM Version NPM Downloads Node.js Version Build Status Coverage Status

Create and parse HTTP Content-Type header according to RFC 7231

Installation

$ npm install content-type

API

var contentType = require('content-type')

contentType.parse(string)

var obj = contentType.parse('image/svg+xml; charset=utf-8')

Parse a Content-Type header. This will return an object with the following properties (examples are shown for the string 'image/svg+xml; charset=utf-8'):

Throws a TypeError if the string is missing or invalid.

contentType.parse(req)

var obj = contentType.parse(req)

Parse the Content-Type header from the given req. Short-cut for contentType.parse(req.headers['content-type']).

Throws a TypeError if the Content-Type header is missing or invalid.

contentType.parse(res)

var obj = contentType.parse(res)

Parse the Content-Type header set on the given res. Short-cut for contentType.parse(res.getHeader('content-type')).

Throws a TypeError if the Content-Type header is missing or invalid.

contentType.format(obj)

var str = contentType.format({
  type: 'image/svg+xml',
  parameters: { charset: 'utf-8' }
})

Format an object into a Content-Type header. This will return a string of the content type for the given object with the following properties (examples are shown that produce the string 'image/svg+xml; charset=utf-8'):

Throws a TypeError if the object contains an invalid type or parameter names.

License

MIT

Apache/2.4.38 (Debian) Server at www.karls.computer Port 80