{"id":18428,"library":"http-content-range-format","title":"http-content-range-format","description":"Format HTTP Content-Range headers according to RFC 7233. Version 1.0.0 is the latest and stable. This package provides a simple function to construct Content-Range header strings from numeric components. It is minimal, dependency-free, and focused on server-side use cases. No significant breaking changes or known vulnerabilities as of the release.","status":"active","version":"1.0.0","language":"javascript","source_language":"en","source_url":"git://github.com/purposeindustries/node-http-content-range-format","tags":["javascript","http","range","content-range","format"],"install":[{"cmd":"npm install http-content-range-format","lang":"bash","label":"npm"},{"cmd":"yarn add http-content-range-format","lang":"bash","label":"yarn"},{"cmd":"pnpm add http-content-range-format","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"wrong":"const { format } = require('http-content-range-format')","symbol":"default","correct":"import format from 'http-content-range-format'"},{"wrong":"const { format } = require('http-content-range-format')","symbol":"default (CommonJS)","correct":"const format = require('http-content-range-format')"}],"quickstart":{"code":"import format from 'http-content-range-format';\n\n// Format a Content-Range header for bytes 0-499/1234\nconst header = format({ first: 0, last: 499, length: 1234 });\nconsole.log(header); // 'bytes 0-499/1234'\n\n// Format a suffix range (last N bytes)\nconst suffixHeader = format({ length: 100, last: 99, total: 1000 });\nconsole.log(suffixHeader); // 'bytes -99/1000'\n\n// Format an unsatisfied range (length only)\nconst unsatisfiedHeader = format({ length: 0, total: 500 });\nconsole.log(unsatisfiedHeader); // 'bytes */500'","lang":"typescript","description":"Demonstrates formatting Content-Range headers with different range types: first-last, suffix, and unsatisfied."},"warnings":[{"fix":"Ensure all required fields are provided: for a standard range, include 'first' and 'last'; for suffix range, include 'length' and 'last'; for unsatisfied, include 'length' (or 'total' without 'first'/'last').","message":"The library expects object properties 'first', 'last', 'length', and 'total' exactly as documented; missing required fields will cause errors.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Provide 'total' when the total size is known; otherwise, it's optional.","message":"The 'total' field must be provided for a complete range; if omitted, the header will use '*' for total length.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.0.0':17 '7233':15 'accord':12 'break':55 'case':52 'chang':56 'compon':38 'construct':30 'content':3,9,32,68 'content-rang':8,31,67 'depend':43 'dependency-fre':42 'focus':46 'format':5,6,70 'free':44 'function':28 'header':11,34 'http':2,7,65 'http-content-range-format':1 'javascript':64 'known':58 'latest':20 'minim':41 'numer':37 'packag':24 'provid':25 'rang':4,10,33,66,69 'releas':63 'rfc':14 'server':49 'server-sid':48 'side':50 'signific':54 'simpl':27 'stabl':22 'string':35 'use':51 'version':16 'vulner':59","created_at":"2026-04-25T07:38:11.367745+00:00","updated_at":"2026-04-25T07:38:11.367745+00:00","problems":[{"fix":"Pass an object with required properties: format({ first: 0, last: 499, length: 1234 })","cause":"Calling format() without arguments or with undefined/null.","error":"TypeError: Cannot read property 'first' of undefined"},{"fix":"Use default import: const format = require('http-content-range-format')","cause":"Incorrect import (e.g., destructuring default export in CommonJS).","error":"TypeError: format is not a function"}],"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-content-range-format","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/http-content-range-format","openapi_spec":null,"status_page":null,"smithery":null,"categories":["http-networking","serialization"],"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}}