@ironsource/parse-content-range-header

0.0.4 • Public • Published

parse-content-range-header

Parse an http response Content-Range header

npm status Travis

example

npm i -S @ironsource/parse-content-range-header

const parseContentRangeHeader = require('@ironsource/parse-content-range-header')

try {
    console.log(parseContentRangeHeader('bytes 0-100/1000') )
    console.log(parseContentRangeHeader('bytes */1000') )
    console.log(parseContentRangeHeader('bytes 0-100/*') )
} catch (e) {
    console.error(e)
}

api

Table of Contents

parseContentRangeHeader

Parameters

  • headerValue String the value of a Content-Range header The supported forms of this header are specified in this RFC and on MDN

Returns ParseResult

ParseResult

Properties

  • range (Object | String) range start and range end, if range is not satisfiable (isRangeSatisfiable === false), then this will be a *
  • isRangeSatisfiable Boolean a flag indicating if the server can satisfy the range request or not
  • unit String the unit of the range, usually this will be bytes
  • size (Number | String) the full size of the resource. If the size is not known (isSizeKnown === false) then this will be a *
  • isSizeKnown Boolean a flag indicating if the server knows the size of the resource or not

license

MIT © ironSource ltd

Package Sidebar

Install

npm i @ironsource/parse-content-range-header

Weekly Downloads

1

Version

0.0.4

License

MIT

Unpacked Size

9.9 kB

Total Files

7

Last publish

Collaborators

  • it-ironsrc
  • kessler