|
há 4 meses atrás | |
---|---|---|
.. | ||
HISTORY.md | há 4 meses atrás | |
LICENSE | há 4 meses atrás | |
README.md | há 4 meses atrás | |
index.js | há 4 meses atrás | |
package.json | há 4 meses atrás |
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
})
}