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.
|
|
8 years ago | |
|---|---|---|
| .. | ||
| HISTORY.md | 8 years ago | |
| LICENSE | 8 years ago | |
| README.md | 8 years ago | |
| index.js | 8 years ago | |
| package.json | 8 years ago | |
README.md
range-parser
Range header field parser.
Installation
$ npm install range-parser
API
var parseRange = require('range-parser')
parseRange(size, header)
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.
-2signals a malformed header string-1signals 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
})
}