sharefly

Send a web page, or any file, as a link.

sharefly uploads a file or folder from your terminal and prints a link. HTML and Markdown open as pages, images and videos show in the page, anything else is a download. It works on your machine with zero setup, and for anyone on the internet once you add a Cloudflare Tunnel.

brew install --cask hackmajoris/apps/sharefly Builds for macOS and Linux, or build from source with Go.

What your link opens

Pages, whole sites and Markdown open as they are, under a bar with the expiry. Images and videos show in the page with a Download button. Any other file gets a download page. Pick a file to see what visitors get.

$ sharefly serve report.html

report.htmlExpires in 7 days

Q3 report

Revenue by month, July to September

Shared with sharefly

What you can do with it

Every box starts with the command that does it.

Share

$ sharefly serve report.html

Send one page, or any file

Any HTML file, any name, opens as a page. Images and videos show in the page; any other file (an archive, a PDF) gets a download page. The first run starts a background server for you.

$ sharefly serve ./site

Send a whole site

A folder with an index.html at its root, with its CSS, scripts and images. Use relative links inside it.

$ sharefly serve notes.md

Send Markdown as a formatted page

Headings, tables, task lists and code come out readable in light or dark, with a button to download the original .md.

$ sharefly serve report.html | pbcopy

Script it

serve prints only the link, so it pipes into pbcopy, open or your own scripts.

Choose who can open it

$ sharefly serve report.html

Keep it on this machine

The default. Links point at 127.0.0.1 and nothing leaves your computer.

$ sharefly serve report.html --tunnel quick

Make it public in seconds

A random trycloudflare.com address, no account or domain. Needs cloudflared; the address changes when the server restarts.

$ sharefly config set tunnel token

Use your own domain

Links on your Cloudflare domain that keep working. sharefly runs cloudflared for you and never calls the Cloudflare API.

$ sharefly config set server hlab:7787

Share from all your devices

Run the server on one machine in your Tailscale network and point every other device at it.

Stay in control

$ sharefly serve report.html --ttl 1h

Links that expire

Pick 30m, 1h, 3d or never; the default is 7 days. renew extends a link, rm ends it at once. Visitors see the expiry above the page.

$ sharefly serve secret.html --once

Links that work once

The link waits until someone presses Open, so chat previews don't use it up. That browser gets the page for a minute; after that, and for anyone else, it's gone.

$ sharefly serve report.html --password
password: k7f3-x9qa-2mzt-c4wq

Lock a share with a password

sharefly generates one and shows it once. Visitors get a password page; it goes to stderr, so pipes still get only the link.

$ sharefly dashboard

Manage shares in your browser

Opens a private page for the server you use, on this machine or your Tailscale host: every share with copy, renew and delete. It's never reachable through the public tunnel.

Run it your way

$ sharefly service install

Start at boot

Installs a launchd service on macOS or a systemd unit on Linux that restarts the server if it stops.

$ sharefly config

One settings file

Every setting with where it comes from. Flags override the file for a single command; there are no environment variables to track.

$ sharefly ls

See everything at a glance

Every share with its ID, name, expiry and link, in local time.

Make links public with a Cloudflare Tunnel

sharefly runs cloudflared for you, restarts it if it crashes and stops it with the server. Pick the quick tunnel to try it, your own domain for links that last.

Quick tunnel: no account, no domain

$ brew install cloudflared
$ sharefly config set tunnel quick
$ sharefly serve report.html
https://<random-words>.trycloudflare.com/<id>

The address changes every time the server starts, so links stop working after sharefly stop.

Your own domain: needs a domain on Cloudflare

  1. Create a tunnel in the Cloudflare dashboard under Zero Trust, Networks, Tunnels. On the install screen, copy only the token (the long eyJ… string); don't run the install command.
  2. Add a public hostname to the tunnel, e.g. share.yourdomain.com, with service HTTP and URL 127.0.0.1:7788.
  3. Give sharefly the token and the hostname. The token is stored in your config file, readable only by you, and never appears on the command line.
$ brew install cloudflared
$ sharefly config set tunnel-token eyJ...
$ sharefly config set public-url share.yourdomain.com
$ sharefly config set tunnel token
$ sharefly serve report.html
https://share.yourdomain.com/<id>

If you installed cloudflared as a system service before, remove it with sudo cloudflared service uninstall so two connectors don't share the tunnel.

What happens when you run serve

  1. Checks your input before connecting: the TTL, and an index.html in a folder.
  2. Starts the server in the background if none answers on this machine.
  3. Uploads a tar.gz to the server's local API, up to 100MB.
  4. Unpacks it safely: regular files only, size and file-count limits enforced while reading.
  5. Publishes it under a random 10-character ID and prints the link.

Expired shares are removed within 5 minutes. Every page is sent with Cache-Control: private, no-store, so a deleted share doesn't linger in Cloudflare's cache. The file server never lists directories.