Skip to content

Instantly share code, notes, and snippets.

View Blunderchips's full-sized avatar

Matthew Van der Bijl Blunderchips

View GitHub Profile
app.get('/video', function(req, res) {
const path = 'assets/sample.mp4'
const stat = fs.statSync(path)
const fileSize = stat.size
const range = req.headers.range
if (range) {
const parts = range.replace(/bytes=/, "").split("-")
const start = parseInt(parts[0], 10)
const end = parts[1]
? parseInt(parts[1], 10)