{"id":18434,"library":"http-range-parse","title":"http-range-parse","description":"Parses HTTP Range headers according to RFC7233. Current version 1.0.0, stable with no recent updates. Converts a range header string into a structured object with unit and range details (first, last, suffix, or multiple ranges). Lightweight, no dependencies. Compared to alternatives like `range-parser`, this library returns a more detailed object and supports multi-range headers.","status":"active","version":"1.0.0","language":"javascript","source_language":"en","source_url":"git://github.com/purposeindustries/node-http-range-parse","tags":["javascript","http","range","parse"],"install":[{"cmd":"npm install http-range-parse","lang":"bash","label":"npm"},{"cmd":"yarn add http-range-parse","lang":"bash","label":"yarn"},{"cmd":"pnpm add http-range-parse","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package is ESM-only since v1? Actually v1.0.0 uses CommonJS, but for modern code use ESM import. Check your Node version.","wrong":"const parse = require('http-range-parse')","symbol":"parse","correct":"import parse from 'http-range-parse'"},{"note":"CommonJS require works as package exports a single function.","wrong":null,"symbol":"parse","correct":"const parse = require('http-range-parse')"},{"note":"Default export is the parse function; named import `parse` is also available.","wrong":"import httpRangeParse from 'http-range-parse'","symbol":"parse","correct":"import { parse } from 'http-range-parse'"}],"quickstart":{"code":"const parse = require('http-range-parse');\n\nconst header = 'bytes=0-499,500-999';\nconst result = parse(header);\nconsole.log(result);\n// { unit: 'bytes', ranges: [{ first: 0, last: 499 }, { first: 500, last: 999 }] }","lang":"javascript","description":"Parses an HTTP Range header and prints the structured result with unit and range objects."},"warnings":[{"fix":"Validate input header string before parsing; handle errors with try/catch.","message":"Invalid range formats may return unexpected results or throw.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Consider using alternatives like `range-parser` or `http-range-parser` for ongoing support.","message":"Package is not actively maintained; last release 2015.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Check for `suffix` property separately and ensure it's not used with `first`/`last` in same header.","message":"Suffix range notation (-N) returns suffix property, but combined with other ranges may be misinterpreted.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Manually verify the unit is one of the expected values (e.g., 'bytes') if required.","message":"The package does not validate units; any string before '=' is accepted as unit.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.0.0':14 'accord':9 'altern':45 'compar':43 'convert':20 'current':12 'depend':42 'detail':33,55 'first':34 'header':8,23,62 'http':2,6,64 'http-range-pars':1 'javascript':63 'last':35 'librari':51 'lightweight':40 'like':46 'multi':60 'multi-rang':59 'multipl':38 'object':28,56 'pars':4,5,66 'parser':49 'rang':3,7,22,32,39,48,61,65 'range-pars':47 'recent':18 'return':52 'rfc7233':11 'stabl':15 'string':24 'structur':27 'suffix':36 'support':58 'unit':30 'updat':19 'version':13","created_at":"2026-04-25T07:38:12.663793+00:00","updated_at":"2026-04-25T07:38:12.663793+00:00","problems":[{"fix":"Use `import parse from 'http-range-parse'` or `const parse = require('http-range-parse')` depending on module system.","cause":"Incorrect import in ESM context (using default import for CJS module).","error":"TypeError: parse is not a function"},{"fix":"Run `npm install http-range-parse`.","cause":"Package not installed or not in node_modules.","error":"Cannot find module 'http-range-parse'"},{"fix":"Check header format; ensure it follows RFC7233 (e.g., 'unit=x-y').","cause":"Passing invalid or empty string to parse.","error":"Range header is malformed"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/purposeindustries/node-http-range-parse","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/http-range-parse","openapi_spec":null,"status_page":null,"smithery":null,"categories":["http-networking"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-24","install_tag":null}}