binks-cli (0.8.0)
Installation
[registries.forgejo]
index = "sparse+ " # Sparse index
# index = " " # Git
[net]
git-fetch-with-cli = truecargo add binks-cli@0.8.0 --registry forgejoAbout this package
binks
Command-line client for Binks: paste text, upload files of any size (resumable, in parallel), shorten links, with passwords, end-to-end encryption, expiry and burn-after-reading.
cargo install --path . # installs the `binks` binary
binks config set server https://binks.example # or export BINKS_URL
Usage
echo "hello" | binks # paste stdin; binary input becomes a file
binks paste "some text" -l rust # text with syntax highlighting
binks paste "see diagram" -f d.png # text with an attached file
binks upload video.mp4 -e 1w # file, expires in a week
binks shorten https://example.com/long/url
binks get https://binks.example/abc # print a paste / download a file
binks get abc -o out.bin # save under another name
binks get abc --info # metadata only
binks delete abc # uses the deletion token saved at upload
Results go to stdout and everything else to stderr, so url=$(binks upload f) just works.
--json prints machine-readable results, -q silences status output, -c copies the URL.
Options work before or after the command:
| Option | |
|---|---|
-e, --expiration |
1h, 1d, 1w, 1m, 1y, never |
-b, --burn-after N |
delete after N reads |
-p, --password PW / -P |
password-protect (or unlock); -P prompts instead |
--encrypted |
end-to-end encrypt; the key is appended to the URL as #k=... |
--key KEY |
encryption key to use, or to decrypt with |
--id ID |
custom ID |
--server URL |
server (also BINKS_URL, or server in the config) |
--token TOKEN |
API token (also BINKS_TOKEN) |
Encryption happens locally: the server stores ciphertext and sees neither the file name,
its type nor the paste's language. Pastes and files encrypted in the CLI open in the browser
and vice versa, as long as the URL keeps its #k= fragment.
Large files are uploaded in chunks, in parallel parts when the server allows it. If an
upload is interrupted, run the same command again to resume it. Downloads stream to disk and
never overwrite an existing file unless you pass --force.
Scanning. On servers that scan uploads, new files may be unavailable for a moment;
binks get --wait waits instead of failing.
Accounts
binks login # signs in once and saves an API token for this machine
binks whoami
binks token create ci --scope upload --expires 30 # prints a token for scripts
binks token list
binks logout # revokes this machine's token
binks register # when the server allows sign-ups
Signed-in users can delete their own content without a deletion token.
Configuration
Settings live in ~/.config/binks/config.toml (BINKS_CLI_CONFIG overrides the path):
binks config show | get | set | unset | edit | path | reset. Keys: server, expiration,
burn_after, auto_copy, json_output, insecure, ca_cert, token.
Deletion tokens and interrupted uploads are kept in ~/.local/state/binks/.
Shell completions: binks completions bash > ~/.local/share/bash-completion/completions/binks
(also zsh, fish, powershell, elvish).
Development
cargo fmt --check && cargo clippy --all-targets -- -D warnings
cargo test
The integration tests in tests/cli.rs run the binary against an in-process Binks server,
pulled in as a git dev-dependency. To test against a local server checkout:
cargo test --config 'patch."https://github.com/RaringM/binks".binks.path="../binks"'.
E2EE test vectors (tests/data/e2ee-vectors.json) are shared with the server's web app.
Dependencies
| ID | Version |
|---|---|
| aes-gcm | ^0.11 |
| anyhow | ^1.0 |
| arboard | ^3.6 |
| base64 | ^0.23 |
| bytes | ^1.12 |
| chrono | ^0.4 |
| clap | ^4.6 |
| clap_complete | ^4.6 |
| futures-util | ^0.3 |
| getrandom | ^0.4 |
| indicatif | ^0.18 |
| infer | ^0.22 |
| mime_guess | ^2.0 |
| reqwest | ^0.13 |
| rpassword | ^7.5 |
| rustls | ^0.23 |
| serde | ^1.0 |
| serde_json | ^1.0 |
| tempfile | ^3.27 |
| tokio | ^1.53 |
| toml | ^1.1 |
| actix-web | ^4.13 |