@ironsource/parse-content-range-header
v0.0.4
Published
Parse an http response Content-Range header
Downloads
7
Readme
parse-content-range-header
Parse an http response Content-Range header
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 aContent-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 notunit
String the unit of the range, usually this will bebytes
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