Secure, zero-config HTTP video streaming utility for Node.js
npm install streamify-videostreamify-video makes video streaming effortless by handling HTTP Range requests , secure access , and edge cases for you.
Range headers
bash
npm install streamify-video
`
---
Quick Start
`ts
import express from "express";
import { streamVideo } from "streamify-video";
const app = express();
app.get(
"/video/:filename",
streamVideo({
videoDir: "./videos"
})
);
app.listen(3000, () => {
console.log("Server running on http://localhost:3000");
});
`
Open in browser:
`
http://localhost:3000/video/sample.mp4
`
---
Secure Streaming (Token / Password)
$3
`ts
app.get(
"/video/:filename",
streamVideo({
videoDir: "./videos",
token: "secret123"
})
);
`
Request:
`
/video/movie.mp4?token=secret123
`
Or via header:
`
x-stream-token: secret123
`
---
$3
`ts
app.get(
"/video/:filename",
streamVideo({
videoDir: "./videos",
password: "mypassword"
})
);
`
Request:
`
/video/movie.mp4?password=mypassword
`
---
Configuration Options
`ts
streamVideo({
videoDir: string; // Required: directory containing videos
token?: string; // Optional: secure token
password?: string; // Optional: password protection
})
`
---
Supported Video Formats
* MP4 (video/mp4)
* WebM (video/webm)
* MKV (video/x-matroska)
* AVI (video/x-msvideo)
* MOV (video/quicktime)
(Other formats fall back to application/octet-stream.)
---
How It Works
* Automatically parses HTTP Range headers
* Validates invalid or out-of-bound ranges
* Streams only requested chunks
* Sends correct response headers:
* Content-Range
* Accept-Ranges
* Content-Length
* Content-Type`