|
|
пре 11 месеци | |
|---|---|---|
| .. | ||
| HISTORY.md | пре 11 месеци | |
| LICENSE | пре 11 месеци | |
| README.md | пре 11 месеци | |
| index.js | пре 11 месеци | |
| package.json | пре 11 месеци | |
Range header field parser.
$ npm install range-parser
var parseRange = require('range-parser')
Parse the given header string where size is the maximum size of the resource.
An array of ranges will be returned or negative numbers indicating an error parsing.
-2 signals a malformed header string-1 signals an invalid range
// parse header from request
var range = parseRange(req.headers.range)
// the type of the range
if (range.type === 'bytes') {
// the ranges
range.forEach(function (r) {
// do something with r.start and r.end
})
}