data-media-type

0.1.0 • Public • Published

data-media-type

A Node.js module for finding IANA registered names for common data types.

See also:

Install

$ npm install data-media-type

Usage

var http = require('http');
var DataMediaType = require('data-media-type');
 
http.createServer(function(req, res) {
  res.statusCode = 200;
  res.setHeader('Content-Type', DataMediaType.JSON);
 
  var body = {
    hello: 'world'
  };
 
  res.end(JSON.stringify(body));
}).listen(1337);

Supported Media Types

  • DataMediaType.FORM_URLENCODED => application/x-www-form-urlencoded
  • DataMediaType.JSON => application/json
  • DataMediaType.MULTIPART_FORM_DATA => multipart/form-data
  • DataMediaType.OCTET_STREAM => application/octet-stream
  • DataMediaType.TEXT_PLAIN => text/plain
  • DataMediaType.TEXT_XML => text/xml
  • DataMediaType.XML => application/xml

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i data-media-type

Weekly Downloads

3

Version

0.1.0

License

MIT

Last publish

Collaborators

  • kevinswiber