Skip to content
This repository has been archived by the owner on May 20, 2024. It is now read-only.

ironSource/parse-content-range-header

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Parse an http response Content-Range header

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published