Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
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.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. # range-parser
  2. [![NPM Version][npm-version-image]][npm-url]
  3. [![NPM Downloads][npm-downloads-image]][npm-url]
  4. [![Node.js Version][node-image]][node-url]
  5. [![Build Status][travis-image]][travis-url]
  6. [![Test Coverage][coveralls-image]][coveralls-url]
  7. Range header field parser.
  8. ## Installation
  9. This is a [Node.js](https://nodejs.org/en/) module available through the
  10. [npm registry](https://www.npmjs.com/). Installation is done using the
  11. [`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
  12. ```sh
  13. $ npm install range-parser
  14. ```
  15. ## API
  16. <!-- eslint-disable no-unused-vars -->
  17. ```js
  18. var parseRange = require('range-parser')
  19. ```
  20. ### parseRange(size, header, options)
  21. Parse the given `header` string where `size` is the maximum size of the resource.
  22. An array of ranges will be returned or negative numbers indicating an error parsing.
  23. * `-2` signals a malformed header string
  24. * `-1` signals an unsatisfiable range
  25. <!-- eslint-disable no-undef -->
  26. ```js
  27. // parse header from request
  28. var range = parseRange(size, req.headers.range)
  29. // the type of the range
  30. if (range.type === 'bytes') {
  31. // the ranges
  32. range.forEach(function (r) {
  33. // do something with r.start and r.end
  34. })
  35. }
  36. ```
  37. #### Options
  38. These properties are accepted in the options object.
  39. ##### combine
  40. Specifies if overlapping & adjacent ranges should be combined, defaults to `false`.
  41. When `true`, ranges will be combined and returned as if they were specified that
  42. way in the header.
  43. <!-- eslint-disable no-undef -->
  44. ```js
  45. parseRange(100, 'bytes=50-55,0-10,5-10,56-60', { combine: true })
  46. // => [
  47. // { start: 0, end: 10 },
  48. // { start: 50, end: 60 }
  49. // ]
  50. ```
  51. ## License
  52. [MIT](LICENSE)
  53. [coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/range-parser/master
  54. [coveralls-url]: https://coveralls.io/r/jshttp/range-parser?branch=master
  55. [node-image]: https://badgen.net/npm/node/range-parser
  56. [node-url]: https://nodejs.org/en/download
  57. [npm-downloads-image]: https://badgen.net/npm/dm/range-parser
  58. [npm-url]: https://npmjs.org/package/range-parser
  59. [npm-version-image]: https://badgen.net/npm/v/range-parser
  60. [travis-image]: https://badgen.net/travis/jshttp/range-parser/master
  61. [travis-url]: https://travis-ci.org/jshttp/range-parser