arnaucube
arnaucube/comunicationLeapPublic Self-hosted repository
comunicationLeap/node_modules/range-parser/Readme.md
node_modules/range-parser/Readme.mdRaw
 1
 2# node-range-parser
 3
 4  Range header field parser.
 5
 6## Example:
 7
 8```js
 9assert(-1 == parse(200, 'bytes=500-20'));
10assert(-2 == parse(200, 'bytes=malformed'));
11parse(200, 'bytes=0-499').should.eql(arr('bytes', [{ start: 0, end: 199 }]));
12parse(1000, 'bytes=0-499').should.eql(arr('bytes', [{ start: 0, end: 499 }]));
13parse(1000, 'bytes=40-80').should.eql(arr('bytes', [{ start: 40, end: 80 }]));
14parse(1000, 'bytes=-500').should.eql(arr('bytes', [{ start: 500, end: 999 }]));
15parse(1000, 'bytes=-400').should.eql(arr('bytes', [{ start: 600, end: 999 }]));
16parse(1000, 'bytes=500-').should.eql(arr('bytes', [{ start: 500, end: 999 }]));
17parse(1000, 'bytes=400-').should.eql(arr('bytes', [{ start: 400, end: 999 }]));
18parse(1000, 'bytes=0-0').should.eql(arr('bytes', [{ start: 0, end: 0 }]));
19parse(1000, 'bytes=-1').should.eql(arr('bytes', [{ start: 999, end: 999 }]));
20parse(1000, 'items=0-5').should.eql(arr('items', [{ start: 0, end: 5 }]));
21parse(1000, 'bytes=40-80,-1').should.eql(arr('bytes', [{ start: 40, end: 80 }, { start: 999, end: 999 }]));
22```
23
24## Installation
25
26```
27$ npm install range-parser
28```