range-parser

WebJar for range-parser

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

range-parser
Last Version

Last Version

1.2.1
Release Date

Release Date

Type

Type

jar
Description

Description

range-parser
WebJar for range-parser
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/jshttp/range-parser

Download range-parser

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/range-parser/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>range-parser</artifactId>
    <version>1.2.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/range-parser/
implementation 'org.webjars.npm:range-parser:1.2.1'
// https://jarcasting.com/artifacts/org.webjars.npm/range-parser/
implementation ("org.webjars.npm:range-parser:1.2.1")
'org.webjars.npm:range-parser:jar:1.2.1'
<dependency org="org.webjars.npm" name="range-parser" rev="1.2.1">
  <artifact name="range-parser" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='range-parser', version='1.2.1')
)
libraryDependencies += "org.webjars.npm" % "range-parser" % "1.2.1"
[org.webjars.npm/range-parser "1.2.1"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

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 size of the selected representation that is to be partitioned into subranges. An array of subranges will be returned or negative numbers indicating an error parsing.

  • -2 signals a malformed header string
  • -1 signals an unsatisfiable range
// parse header from request
var subranges = parseRange(size, req.headers.range)

// the type of the subranges
if (subranges.type === 'bytes') {
  // the ranges
  subranges.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 subranges 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

org.webjars.npm
Low-Level JavaScript HTTP-related Modules

Versions

Version
1.2.1
1.2.0
1.0.3
1.0.2
1.0.0