socketioMEANseed/server/node_modules/range-parser/README.md
server/node_modules/range-parser/README.mdRaw
1# range-parser
2
3[![NPM Version][npm-image]][npm-url]
4[![NPM Downloads][downloads-image]][downloads-url]
5[![Node.js Version][node-version-image]][node-version-url]
6[![Build Status][travis-image]][travis-url]
7[![Test Coverage][coveralls-image]][coveralls-url]
8
9Range header field parser.
10
11## Installation
12
13```
14$ npm install range-parser
15```
16
17## API
18
19```js
20var parseRange = require('range-parser')
21```
22
23### parseRange(size, header)
24
25Parse the given `header` string where `size` is the maximum size of the resource.
26An array of ranges will be returned or negative numbers indicating an error parsing.
27
28 * `-2` signals a malformed header string
29 * `-1` signals an invalid range
30
31```js
32// parse header from request
33var range = parseRange(req.headers.range)
34
35// the type of the range
36if (range.type === 'bytes') {
37 // the ranges
38 range.forEach(function (r) {
39 // do something with r.start and r.end
40 })
41}
42```
43
44## License
45
46[MIT](LICENSE)
47
48[npm-image]: https://img.shields.io/npm/v/range-parser.svg
49[npm-url]: https://npmjs.org/package/range-parser
50[node-version-image]: https://img.shields.io/node/v/range-parser.svg
51[node-version-url]: http://nodejs.org/download/
52[travis-image]: https://img.shields.io/travis/jshttp/range-parser.svg
53[travis-url]: https://travis-ci.org/jshttp/range-parser
54[coveralls-image]: https://img.shields.io/coveralls/jshttp/range-parser.svg
55[coveralls-url]: https://coveralls.io/r/jshttp/range-parser
56[downloads-image]: https://img.shields.io/npm/dm/range-parser.svg
57[downloads-url]: https://npmjs.org/package/range-parser