Summary
JSS currently doesn't support HTTP Range requests, which means video/audio seeking (skipping forward/back) doesn't work.
Current Behavior
When a client requests a byte range (e.g., seeking in a video), JSS ignores the Range header and returns the full file with status 200.
Expected Behavior
JSS should:
- Check for
Range header in GET requests
- Parse byte range (e.g.,
bytes=1000-2000 or bytes=1000-)
- Return partial content with status
206 Partial Content
- Include proper headers:
Content-Range: bytes start-end/total
Accept-Ranges: bytes
Content-Length: chunksize
Use Cases
- Video seeking - Skip to any point in a video without downloading the whole file
- Audio seeking - Same for audio files
- Resumable downloads - Resume interrupted large file downloads
- Efficient streaming - Only transfer what's needed
Reference Implementation
NSS has this in lib/ldp.mjs:470-490 and lib/handlers/get.mjs:54,124-128:
// Parse range header
if (options.range) {
const parts = options.range.replace(/bytes=/, '').split('-')
const start = parseInt(parts[0], 10)
const end = parts[1] ? parseInt(parts[1], 10) : total - 1
const chunksize = (end - start) + 1
contentRange = 'bytes ' + start + '-' + end + '/' + total
// Create read stream with range
stream = fs.createReadStream(path, { start, end })
}
// Set response headers
if (contentRange) {
res.status(206)
res.set({
'Content-Range': contentRange,
'Accept-Ranges': 'bytes',
'Content-Length': chunksize
})
}
Implementation Notes
For JSS with Fastify, the implementation would go in the GET handler:
- Check
request.headers.range
- Use
fs.createReadStream(path, { start, end }) for partial reads
- Set appropriate response headers and status 206
Summary
JSS currently doesn't support HTTP Range requests, which means video/audio seeking (skipping forward/back) doesn't work.
Current Behavior
When a client requests a byte range (e.g., seeking in a video), JSS ignores the
Rangeheader and returns the full file with status 200.Expected Behavior
JSS should:
Rangeheader in GET requestsbytes=1000-2000orbytes=1000-)206 Partial ContentContent-Range: bytes start-end/totalAccept-Ranges: bytesContent-Length: chunksizeUse Cases
Reference Implementation
NSS has this in
lib/ldp.mjs:470-490andlib/handlers/get.mjs:54,124-128:Implementation Notes
For JSS with Fastify, the implementation would go in the GET handler:
request.headers.rangefs.createReadStream(path, { start, end })for partial reads