Ein Projekt das es ermöglicht Beerpong über das Internet von zwei unabhängigen positionen aus zu spielen. Entstehung im Rahmen einer Praktikumsaufgabe im Fach Interaktion.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. # media-typer
  2. [![NPM Version][npm-image]][npm-url]
  3. [![NPM Downloads][downloads-image]][downloads-url]
  4. [![Node.js Version][node-version-image]][node-version-url]
  5. [![Build Status][travis-image]][travis-url]
  6. [![Test Coverage][coveralls-image]][coveralls-url]
  7. Simple RFC 6838 media type parser
  8. ## Installation
  9. ```sh
  10. $ npm install media-typer
  11. ```
  12. ## API
  13. ```js
  14. var typer = require('media-typer')
  15. ```
  16. ### typer.parse(string)
  17. ```js
  18. var obj = typer.parse('image/svg+xml; charset=utf-8')
  19. ```
  20. Parse a media type string. This will return an object with the following
  21. properties (examples are shown for the string `'image/svg+xml; charset=utf-8'`):
  22. - `type`: The type of the media type (always lower case). Example: `'image'`
  23. - `subtype`: The subtype of the media type (always lower case). Example: `'svg'`
  24. - `suffix`: The suffix of the media type (always lower case). Example: `'xml'`
  25. - `parameters`: An object of the parameters in the media type (name of parameter always lower case). Example: `{charset: 'utf-8'}`
  26. ### typer.parse(req)
  27. ```js
  28. var obj = typer.parse(req)
  29. ```
  30. Parse the `content-type` header from the given `req`. Short-cut for
  31. `typer.parse(req.headers['content-type'])`.
  32. ### typer.parse(res)
  33. ```js
  34. var obj = typer.parse(res)
  35. ```
  36. Parse the `content-type` header set on the given `res`. Short-cut for
  37. `typer.parse(res.getHeader('content-type'))`.
  38. ### typer.format(obj)
  39. ```js
  40. var obj = typer.format({type: 'image', subtype: 'svg', suffix: 'xml'})
  41. ```
  42. Format an object into a media type string. This will return a string of the
  43. mime type for the given object. For the properties of the object, see the
  44. documentation for `typer.parse(string)`.
  45. ## License
  46. [MIT](LICENSE)
  47. [npm-image]: https://img.shields.io/npm/v/media-typer.svg?style=flat
  48. [npm-url]: https://npmjs.org/package/media-typer
  49. [node-version-image]: https://img.shields.io/badge/node.js-%3E%3D_0.6-brightgreen.svg?style=flat
  50. [node-version-url]: http://nodejs.org/download/
  51. [travis-image]: https://img.shields.io/travis/jshttp/media-typer.svg?style=flat
  52. [travis-url]: https://travis-ci.org/jshttp/media-typer
  53. [coveralls-image]: https://img.shields.io/coveralls/jshttp/media-typer.svg?style=flat
  54. [coveralls-url]: https://coveralls.io/r/jshttp/media-typer
  55. [downloads-image]: https://img.shields.io/npm/dm/media-typer.svg?style=flat
  56. [downloads-url]: https://npmjs.org/package/media-typer