Filedrop

FiledropCli

Command-line interface for the Filedrop service. Create and download file drops from the terminal using the url://filedrop/ P2P protocol.

Building

Build the fat JAR using the Kompile build system:

scripts/build.bash filedrop.cli.buildFatJar /tmp/filedrop-cli.jar

Or launch directly via coursier:

coursier launch filedrop.cli:filedrop-cli:0.0.1 \
  -r https://kotlin.directory \
  -M filedrop.cli.MainKt \
  -- paste -t "My Paste"

Usage

filedrop <command> [options]

Commands

Command Description
paste Read stdin, create a drop with a paste.txt, and print the WUI URL
upload <files...> Upload file(s) to a new drop and print the WUI URL
download <url-or-id> Download all files from a drop to a local directory
list / ls List all drops
info <id-or-url> Show details of a specific drop
delete / rm <id-or-url> Delete a drop

Options

Option Description
-t, --title <title> Title for new drop (paste/upload)
-e, --expires <seconds> Expiration in seconds (default: 86400 = 24h)
-o, --output <dir> Output directory for download (default: current dir)
-w, --wui-url <url> WUI base URL (default: https://filedrop.wasmserver.com)
-h, --help Show help

Examples

Paste text from stdin:

echo "hello world" | java -jar filedrop-cli.jar paste
# Output: https://filedrop.wasmserver.com/drop/abc123

Paste from a file with a title:

java -jar filedrop-cli.jar paste -t "My Notes" < notes.txt

Upload files:

java -jar filedrop-cli.jar upload photo.png document.pdf -t "Project Files"

Download files from a WUI URL:

java -jar filedrop-cli.jar download https://filedrop.wasmserver.com/drop/abc123 -o ~/Downloads

Download by drop ID:

java -jar filedrop-cli.jar download abc123

List all drops:

java -jar filedrop-cli.jar list

Get drop details:

java -jar filedrop-cli.jar info abc123

Delete a drop:

java -jar filedrop-cli.jar delete abc123

How It Works

The CLI connects to the url://filedrop/ service via the P2P network using UrlResolver. It uses the same FiledropApi interface as the FiledropWui web interface. After creating a drop, it prints the web URL so users can share it or open it in a browser.

The download command accepts either a full WUI URL (e.g., https://filedrop.wasmserver.com/drop/abc123) or just a drop ID (abc123), making it easy to download files shared via the web interface.