The Blueprint blog

Subscribe Here!

res.writeHead(206, 'Content-Range': `bytes $start-$end/$fileSize`, 'Accept-Ranges': 'bytes', 'Content-Length': (end - start) + 1, 'Content-Type': 'video/x-matroska' ); fs.createReadStream(FILE, start, end ).pipe(res); else res.writeHead(200, 'Content-Length': fileSize, 'Content-Type': 'video/x-matroska' ); fs.createReadStream(FILE).pipe(res);

Byte-range requests allow a media player to request specific parts of a video file. This enables a user to click forward or backward in a video timeline without waiting for the entire file to buffer or download.