Skip to content

purposeindustries/node-http-range-parse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

http-range-parse Build Status

Parse HTTP Range headers, RFC7233 compilant.

Install

Install the package with npm

$ npm install http-range-parse

Usage

var parse = require('http-range-parse');

console.log(parse('items=1-2,995-,-1'))

API

.parse(str)

Parse the given Range header. The returned object contains the range unit, and the requested range.

parse('items=1-2')
// { unit: 'items', first: 1, last: 2 }

parse('items=-5')
// { unit: 'items', suffix: 5 }

parse('items=1-')
// { unit: 'items', first: 1 }

parse('items=1-2,3-4')
// { unit: 'items', ranges: [{ first: 1, last: 2 }, { first: 3, last: 4 }] }

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published