ferry

Share huge files from your own server with unguessable, resumable direct links. One Node file, no dependencies.

stars
1
forks
0
lines of code
195
Languages
JavaScript
license
MIT
updated
ci
CI passing
~/ferryFLOW · 59.44N 18.13E
README.mdmain

ferry

CI Release License: MIT

Share huge files (hundreds of GB) from your own server with a direct, resumable download link.

Drop a file into a folder, get a link like https://files.example.com/Xk3…/movie.mkv, send it to a friend. They download it with a browser, curl -C -, wget -c, aria2 or any download manager, and it resumes if it breaks.

Features

  • One file, Node.js 18+, no dependencies
  • Unguessable links: each link carries an HMAC of the file path, so there is no listing and no database
  • HTTP range requests: resume, parallel segmented downloads, HEAD
  • No size limit, no request timeout, streams from disk
  • Folder links: one link opens a page listing every file below it, each with its own resumable link, plus a ?list URL with all links as plain text for wget -i or a download manager
  • Revoke a link by deleting the file, or every link at once by rotating the secret

Install

git clone https://github.com/Tjabooo/ferry && cd ferry
cp .env.example .env   # set FERRY_DIR and FERRY_BASE_URL
node server.js

Put it behind HTTPS: a reverse proxy (Caddy, nginx) or a Cloudflare Tunnel route pointing to http://localhost:8160. Keep it running with systemd, a Windows scheduled task (start.cmd logs to logs/ferry.log) or similar.

Usage

node server.js list            # every file and top-level folder with its link
node server.js link "big.iso"  # link for FERRY_DIR/big.iso (subfolder: "dir/big.iso")
node server.js link "Photos"   # folder link: a download page for everything in FERRY_DIR/Photos

Copy files into FERRY_DIR however you like (SCP, SMB, rsync).

ferry-ssh wraps it for a remote server:

export FERRY_SSH=myserver FERRY_DROP=E:/Drop
ferry-ssh put ./big.iso   # upload + print the link (folders work too)
ferry-ssh ls | link NAME | rm NAME

(ferry-ssh currently assumes a Windows server with OpenSSH; on Linux just run server.js over ssh.)

Configuration

Variable Default
FERRY_DIR ./files folder that can be shared
FERRY_PORT 8160 listen port
FERRY_HOST 127.0.0.1 listen address
FERRY_BASE_URL http://localhost:PORT public URL used in printed links
FERRY_SECRET random, stored in .secret link signing key; change it to revoke every link

Variables can live in .env next to server.js.

How it works

A link is BASE/<token>/<path> where token is the first 22 characters of base64url HMAC-SHA256(secret, path). The server recomputes the token, compares in constant time, keeps the path inside FERRY_DIR and streams the file with Content-Disposition: attachment. Anything else is a 404.

A folder link signs the folder's path the same way. Its page lists every file below it (hidden dot-files skipped), and each file gets its own signed link, so downloads resume per file. A folder link exposes only that folder's contents, never its parent. Grab everything with wget -c -x -nH --cut-dirs=1 -i "FOLDER_LINK?list".

License

MIT

Related projects