Documentation Index
Fetch the complete documentation index at: https://mintlify.com/mohameodo/nano/llms.txt
Use this file to discover all available pages before exploring further.
/api/stream serves video files directly from the server’s filesystem. It supports HTTP Range requests so browsers and media players can seek through large files without downloading them entirely. This endpoint powers nano’s local media library feature, which lets you point nano at a directory of video files and play them through the same player interface used for scraped streams.
Availability
/api/stream is only available on Node.js deployments. If any of the environment variables CF_PAGES, CLOUDFLARE, or WORKERS_CI are set (indicating a Cloudflare Workers/Pages environment), the endpoint returns:
Request
Method:GETPath:
/api/stream
Relative path to the video file to serve. When
base is also provided, path is resolved relative to the base directory. Otherwise it is resolved from the current working directory using path.resolve().Base directory or path to a JSON configuration file. When provided,
path is joined with this directory. If base itself ends in .json (e.g. a rink.json library config path), the containing directory of that file is used as the base. This allows nano to resolve media paths relative to a library config file without you having to compute the directory yourself.Range Requests
The endpoint advertises range support viaAccept-Ranges: bytes on every response. To request a byte range, include the standard Range header:
206 Partial Content and includes:
416 Range Not Satisfiable with a Content-Range: bytes */<total> header.
Supported Formats
TheContent-Type response header is inferred from the file extension:
| Extension | Content-Type |
|---|---|
.mp4 | video/mp4 |
.mkv | video/x-matroska |
.webm | video/webm |
.avi | video/x-msvideo |
.vtt | text/vtt |
.srt | text/vtt (auto-converted to WebVTT) |
video/mp4.
SRT Subtitle Conversion
When the requested file has a.srt extension, the endpoint reads the file as UTF-8 text, converts the comma-separated millisecond timestamps to the dot-separated format required by WebVTT, prepends the WEBVTT header, and returns the result with Content-Type: text/vtt. The original .srt file is never served directly.
Response Headers
| Header | Value |
|---|---|
Access-Control-Allow-Origin | * |
Access-Control-Allow-Methods | GET, OPTIONS |
Access-Control-Allow-Headers | * |
Accept-Ranges | bytes |
Content-Range | bytes <start>-<end>/<total> (206 responses only) |
Content-Length | File size or chunk size in bytes |
Error Responses
| Status | Message | Cause |
|---|---|---|
400 | Missing path parameter | The path query parameter was not provided. |
400 | Not a file | The resolved path exists but is a directory, not a file. |
404 | File not found | The resolved path does not exist on the filesystem. |
416 | Requested range not satisfiable | The Range header specifies a range outside the file bounds. |
500 | Error streaming file: <message> | An unexpected filesystem read error occurred. |
501 | Local streaming is not supported on Cloudflare | The instance is running on Cloudflare Workers/Pages. |