Skip to content

File Streaming Protocol

A protocol for remote file system access with resumable transfers and real-time watching.

What is the File Streaming Protocol?

The File Streaming Protocol enables remote file system operations over HTTP with built-in resumability. Unlike traditional file transfer protocols, large file transfers can be paused and resumed from any point, and directory changes can be watched in real-time.

Built on top of Unbroken Protocol, it combines:

  • Standard HTTP methods for familiar REST semantics
  • Unbroken Protocol for resumable transfers
  • SSE for real-time file watching

Key Features

FeatureDescription
ResumableResume interrupted transfers from exact byte position
StreamableLarge files streamed without memory limits
WatchableReal-time notifications via SSE
Web NativeStandard HTTP methods and headers
CDN FriendlyCacheable responses with ETags

Architecture

┌─────────────────────────────────────────────────────────────┐
│ Client │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ File │ │ Directory │ │ Watch │ │
│ │ Reader │ │ Browser │ │ Listener │ │
│ └──────┬──────┘ └──────┬──────┘ └──────┬──────┘ │
└─────────┼──────────────────┼──────────────────┼─────────────┘
│ GET │ GET/ │ GET?live=sse
▼ ▼ ▼
┌─────────────────────────────────────────────────────────────┐
│ File Server │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ File │ │ Directory │ │ FS │ │
│ │ Storage │ │ Index │ │ Watcher │ │
│ └─────────────┘ └─────────────┘ └─────────────┘ │
└─────────────────────────────────────────────────────────────┘

Quick Example

Terminal window
# Create a file
curl -X PUT http://localhost:9999/files/hello.txt \
-H "Content-Type: text/plain" \
-d "Hello, World!"
# Read a file
curl http://localhost:9999/files/hello.txt
# List directory
curl http://localhost:9999/files/
# Watch for changes (SSE)
curl "http://localhost:9999/files/?live=sse"
# Delete a file
curl -X DELETE http://localhost:9999/files/hello.txt

Protocol at a Glance

Endpoints

MethodPathDescription
PUT/files/{path}Create or update file
PUT/files/{path}/Create directory
GET/files/{path}Read file content
GET/files/{path}/List directory
GET/files/{path}?live=sseWatch for changes
DELETE/files/{path}Delete file or directory
HEAD/files/{path}Get file metadata
POST/files/{path}?op=copy&to={dest}Copy file
POST/files/{path}?op=move&to={dest}Move/rename file

Headers

HeaderDirectionDescription
Content-LengthResponseFile size in bytes
Last-ModifiedResponseModification timestamp
ETagResponseContent hash for caching
Content-TypeBothMIME type of content
RangeRequestByte range for partial reads
Stream-Next-OffsetResponseResume position
File-TypeResponsefile or directory

Watch Events (SSE)

EventDescription
createdNew file or directory created
modifiedFile content changed
deletedFile or directory deleted
renamedFile or directory renamed
snapshotInitial directory state
readySnapshot complete, live events follow

Path Conventions

  • Paths are URL-encoded and relative to server root
  • Trailing slash / indicates directory
  • No trailing slash indicates file
  • Path traversal (../) is rejected

Use Cases

  • Remote Development: Access project files over HTTP
  • Cloud Storage: S3-like object storage API
  • File Sync: Real-time sync with watch events
  • Media Streaming: Resumable video/audio delivery
  • Backup Systems: Large file transfers with resume

Specification

For the complete protocol specification, see PROTOCOL.md.

Default Port

The file server uses port 9999/tcp by default (same as Unbroken Protocol).

Requirements

  • Server: Bun or Node.js runtime
  • Client: Any HTTP client (browser, curl, custom)