No description
Find a file
Miles 021ca86d5e
All checks were successful
CI Test and Lint / Rust Format (push) Successful in 21s
CI Test and Lint / Rust Clippy (push) Successful in 36s
CI Test and Lint / Rust Unit Tests (push) Successful in 1m25s
CI Test and Lint / Cargo Audit (push) Successful in 1m55s
meow
2026-04-08 19:10:10 -05:00
.cargo remove binks as a dependency, and work on cross-ci 2026-04-08 14:24:44 -05:00
.forgejo/workflows skip frontend build (bc of binks) 2026-04-08 16:47:42 -05:00
src add deletion tokens 2026-04-08 19:09:19 -05:00
tests meow 2026-04-08 19:10:10 -05:00
.gitignore remove binks as a dependency, and work on cross-ci 2026-04-08 14:24:44 -05:00
Cargo.lock pin binks to rev & add reqwest/rustls 2026-04-08 19:09:55 -05:00
Cargo.toml pin binks to rev & add reqwest/rustls 2026-04-08 19:09:55 -05:00
README.md split binks-cli from server 2026-04-07 20:06:54 -05:00
rust-toolchain.toml remove binks as a dependency, and work on cross-ci 2026-04-08 14:24:44 -05:00

Binks CLI

A command-line interface for the Binks pastebin service that supports text pastes, file uploads, password protection, and end-to-end encrypted mode.

Installation

cargo build --release

Examples

# Paste from stdin
echo "Hello, World!" | binks

# Paste from file
cat myfile.txt | binks

# Paste with expiration
echo "Temporary paste" | binks --expiration 1h

# Password-protected paste
binks paste --content "My secret" --password

# End-to-end encrypted paste (prints URL with #k=<key>)
binks paste --content "Client-side secret" --encrypted

# Encrypted paste via bare pipe (no subcommand)
echo "secret" | binks --encrypted

# Copy URL to clipboard automatically
echo "Hello" | binks --copy

# Script-friendly: print only the URL
echo "Hello" | binks --quiet

# Print version
binks --version

File Upload

# Upload a single file
binks upload path/to/file.txt

# Upload with custom settings (note: options go before the command)
binks --expiration 1d --password secret upload file.txt

# Upload and copy URL to clipboard
binks --copy upload image.png

# End-to-end encrypted upload
binks upload ./archive.zip --encrypted

Retrieving Pastes and Files

# Get a paste - shows content for text, shows content + downloads file for uploads
# Also falls back to the file endpoint automatically for file-only uploads
binks get PASTE_ID

# Get with password
binks get PASTE_ID --password mypassword

# Get encrypted paste (key can be passed directly or included as URL fragment)
binks get PASTE_ID --key BASE64URL_KEY
binks get "https://binks.example/PASTE_ID#k=BASE64URL_KEY"

# Save text content to file or download file with custom name
binks get PASTE_ID --output myfile.txt

# Fetch raw text content (no metadata parsing)
binks get PASTE_ID --raw

# Show detailed metadata instead of content/downloading
binks get PASTE_ID --info

# Show metadata as JSON for scripting
binks get PASTE_ID --info --json

# Copy file path to clipboard after download
binks get PASTE_ID --copy

Configuration

# Shorten a URL
binks shorten https://example.com/very/long/path

# Shorten with custom ID and expiration
binks shorten https://example.com --id myalias --expiration 1d

# Shorten with burn-after (link expires after N accesses)
binks shorten https://example.com --burn-after 1

Configuration

# Set BINKS_URL environment variable
export BINKS_URL=https://your-binks-server.com

# Or persist it in the config file
binks config set api_url https://your-binks-server.com

# Self-signed / custom CA cert (development)
binks --ca-cert /path/to/ca.pem paste --content "hello"
binks --insecure paste --content "hello"

Options

Global Options

  • --api-url: Set the API URL (overrides config; BINKS_URL env var also accepted)
  • --expiration: Set expiration time (never, 1h, 1d, 1w, 1m, 1y)
  • --burn-after: Number of reads before burning the paste
  • --copy / -c: Copy URL to clipboard after creation
  • --json: Output results as JSON for scripting
  • --quiet / -q: Print only the final URL (suppresses status messages)
  • --encrypted: End-to-end encrypt when piping without a subcommand
  • --key KEY: Provide an explicit encryption key for --encrypted (base64url)
  • --password PASSWORD: Password-protect when piping without a subcommand
  • --url / -u: Custom short ID / URL override
  • --insecure: Accept invalid TLS certificates (DANGEROUS — dev only)
  • --ca-cert PATH: Trust a custom PEM CA certificate bundle
  • --version: Print version and exit

Commands

paste

Create a new text paste

  • --content: Content to paste (reads from stdin if not provided)
  • --file: File to attach to the paste
  • --id: Custom ID for the paste
  • --password [PASSWORD]: Password protect the paste (prompt if omitted)
  • --encrypted: Encrypt paste content and attached file locally (conflicts with --password)
  • --key KEY: Explicit encryption key for --encrypted (otherwise auto-generated)

upload

Upload a file directly (from file path or stdin)

  • path: Path to the file to upload (optional, reads from stdin if not provided)
  • --id: Custom ID for the file
  • --name: Filename to use when uploading from stdin
  • --password [PASSWORD]: Password protect upload (prompt if omitted)
  • --encrypted: Encrypt upload locally (conflicts with --password)
  • --key KEY: Explicit encryption key for --encrypted (otherwise auto-generated)

get

Retrieve a paste or file by ID (shows content for text, shows content + downloads files for uploads; falls back to /api/file/{id} automatically when the paste endpoint returns 404)

  • id: Paste/file ID to retrieve
  • --output: Save content to file or use custom filename for downloads
  • --info: Show metadata information instead of content/downloading
  • --json: Output metadata as JSON (requires --info)
  • --raw: Fetch raw text content directly from /api/paste/{id}/raw
  • --password [PASSWORD]: Password for protected pastes
  • --key KEY: Decryption key for encrypted pastes/files (or use #k= in URL)
  • --force: Overwrite existing files without confirmation

shorten

Shorten a URL

  • url: The URL to shorten
  • --id: Custom short ID
  • --expiration: Expiration time
  • --burn-after: Number of accesses before the link is burned

config

Manage CLI configuration

  • show: Display all current configuration values
  • set <key> <value>: Set a configuration value
  • get <key>: Read a stored value
  • unset <key>: Remove a configured value (restores default)
  • path: Print the path to the active config file
  • reset: Delete the config file and restore all defaults
  • edit: Open the config file in $VISUAL / $EDITOR

Valid config keys: api_url, expiration, auto_copy, burn_after, json_output, session_cookie, insecure, ca_cert

login

Authenticate with the Binks admin API and persist the session cookie

  • [username]: Admin username (prompts if omitted)

delete

Delete a paste, file, or link by ID (requires admin login)

  • id: The ID of the resource to delete