MCPcopy
hub / github.com/nodejs/undici / buildContentRange

Function buildContentRange

lib/web/fetch/util.js:1212–1233  ·  view source on GitHub ↗

* @see https://fetch.spec.whatwg.org/#build-a-content-range * @param {number} rangeStart * @param {number} rangeEnd * @param {number} fullLength

(rangeStart, rangeEnd, fullLength)

Source from the content-addressed store, hash-verified

1210 * @param {number} fullLength
1211 */
1212function buildContentRange (rangeStart, rangeEnd, fullLength) {
1213 // 1. Let contentRange be `bytes `.
1214 let contentRange = 'bytes '
1215
1216 // 2. Append rangeStart, serialized and isomorphic encoded, to contentRange.
1217 contentRange += isomorphicEncode(`${rangeStart}`)
1218
1219 // 3. Append 0x2D (-) to contentRange.
1220 contentRange += '-'
1221
1222 // 4. Append rangeEnd, serialized and isomorphic encoded to contentRange.
1223 contentRange += isomorphicEncode(`${rangeEnd}`)
1224
1225 // 5. Append 0x2F (/) to contentRange.
1226 contentRange += '/'
1227
1228 // 6. Append fullLength, serialized and isomorphic encoded to contentRange.
1229 contentRange += isomorphicEncode(`${fullLength}`)
1230
1231 // 7. Return contentRange.
1232 return contentRange
1233}
1234
1235// A Stream, which pipes the response to zlib.createInflate() or
1236// zlib.createInflateRaw() depending on the first byte of the Buffer.

Callers 1

schemeFetchFunction · 0.85

Calls 1

isomorphicEncodeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…