Share files in CLI with Cloudflare Workers and R2.
- ✅ Linux & macOS
- ✅ Files > 100 MB
- ✅ Password protection
- ✅ Pure CLI operations with minimal dependencies
$ curl -T my.file -u :password https://bin.your.site
Upload successful!
[URL] https://bin.your.site/iPf7AS
[Filename] my.file
[Size] 1234
[Expires at] 20XX-XX-XX 00:00:00 (UTC)
$ curl -u :password -s https://bin.your.site/sh | sh -s large.file
uploading [large.file] to [bin.your.site] in 6 part(s)...
upload created
uploaded part 1
uploaded part 2
uploaded part 3
uploaded part 4
uploaded part 5
uploaded part 6
Upload successful!
[URL] https://bin.your.site/h6Q6Nv
[Filename] large.file
[Size] 123456789
[Expires at] 20XX-XX-XX 00:00:00 (UTC)
- Install wrangler and link your Cloudflare account.
- Create a KV namespace and an R2 bucket on Cloudflare.
- Copy
wrangler.template.toml
towrangler.toml
and modify it accordingly. - Run
wrangler deploy
. - Set the password for your bin with
wrangler secret put PASSWORD
.
You can always access the domain to get the usage!
You can use curl
to directly upload a file smaller than 100 MB (due to the body size limit of free accounts).
Command:
curl -T <filename> -u ':<password>' 'https://bin.your.site/'
curl -X POST -F 'a=@<filename>' -u ':<password>' 'https://bin.your.site/'
Optional parameters:
Query | Header | |
---|---|---|
id |
X-ID |
Specify a file ID for the link. Random IDs by default. |
ttl |
X-TTL |
Expiration TTL in seconds; 0 means never expiring. 604800 (1 week) by default. |
token |
X-Token |
Token required to download the file. None by default. |
filename |
X-Filename |
Filename shown when downloading. The raw filename by default. |
You download an upload script and upload large files with automatic splitting.
Command:
curl -s -u ':<password>' 'https://bin.your.site/' | sh -s - <filename> [options]
Option | |
---|---|
-h |
Show help message. |
-i |
Specify a file ID for the link. Random IDs by default. |
-f |
Filename shown when downloading. The raw filename by default. |
-t |
Expiration TTL in seconds; 0 means never expiring. 604800 (1 week) by default. |
-T |
Token required to download the file. None by default. |
You can list all stored files.
Command:
curl -u ':<password>' 'https://bin.your.site/list'
You can delete a file by its ID.
Command:
curl -X DELETE -u ':<password>' 'https://bin.your.site/<file_id>'