/ moubarak.eu / node_modules / range-parser /

[ICO]NameLast modifiedSizeDescription
[PARENTDIR]Parent Directory  -  
[TXT]HISTORY.md2 years ago917  
[   ]LICENSE2 years ago1.2K 
[TXT]README.md2 years ago2.2K9b1f1b9 rm old utils [كارل مبارك]
[   ]index.js2 years ago2.8K9b1f1b9 rm old utils [كارل مبارك]
[   ]package.json2 years ago1.2K2324c9f added npm start script [كارل مبارك]
README.md

range-parser

NPM Version NPM Downloads Node.js Version Build Status Test Coverage

Range header field parser.

Installation

This is a Node.js module available through the npm registry. Installation is done using the npm install command:

$ npm install range-parser

API

var parseRange = require('range-parser')

parseRange(size, header, options)

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.

// parse header from request
var range = parseRange(size, 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
  })
}

Options

These properties are accepted in the options object.

combine

Specifies if overlapping & adjacent ranges should be combined, defaults to false. When true, ranges will be combined and returned as if they were specified that way in the header.

parseRange(100, 'bytes=50-55,0-10,5-10,56-60', { combine: true })
// => [
//      { start: 0,  end: 10 },
//      { start: 50, end: 60 }
//    ]

License

MIT

Apache/2.4.38 (Debian) Server at www.karls.computer Port 80