Client CLI Reference
Client CLI Reference
Section titled “Client CLI Reference”The stowry-cli is a command-line client for interacting with Stowry servers. It provides a simple interface for uploading, downloading, listing, and deleting objects without writing code.
Overview
Section titled “Overview”Stowry provides two separate binaries:
| Binary | Purpose |
|---|---|
stowry | Server-side CLI for running and managing the Stowry server |
stowry-cli | Client-side CLI for interacting with a running Stowry server |
Server Mode Awareness
Section titled “Server Mode Awareness”Commands behave differently depending on the server’s mode:
| Command | Store Mode | Static Mode | SPA Mode |
|---|---|---|---|
upload | Works | Works | Works |
download | Returns file or 404 | Returns file, tries path/index.html, or 404 | Returns file or falls back to /index.html |
delete | Works | Works | Works |
list | Works | 404 error | 404 error |
Installation
Section titled “Installation”Binary Download
Section titled “Binary Download”Download pre-built binaries from the GitHub Releases page.
# amd64curl -LO https://github.com/sagarc03/stowry/releases/latest/download/stowry-cli_VERSION_linux_amd64.tar.gztar xzf stowry-cli_VERSION_linux_amd64.tar.gzsudo mv stowry-cli /usr/local/bin/
# arm64curl -LO https://github.com/sagarc03/stowry/releases/latest/download/stowry-cli_VERSION_linux_arm64.tar.gztar xzf stowry-cli_VERSION_linux_arm64.tar.gzsudo mv stowry-cli /usr/local/bin/Replace VERSION with the desired version (e.g., 1.0.0). Check the releases page for available versions.
# Apple Silicon (M1/M2/M3)curl -LO https://github.com/sagarc03/stowry/releases/latest/download/stowry-cli_VERSION_darwin_arm64.tar.gztar xzf stowry-cli_VERSION_darwin_arm64.tar.gzsudo mv stowry-cli /usr/local/bin/
# Intelcurl -LO https://github.com/sagarc03/stowry/releases/latest/download/stowry-cli_VERSION_darwin_amd64.tar.gztar xzf stowry-cli_VERSION_darwin_amd64.tar.gzsudo mv stowry-cli /usr/local/bin/Windows
Section titled “Windows”Download stowry-cli_VERSION_windows_amd64.zip from the releases page, extract the archive, and add the binary to your PATH.
Build from Source
Section titled “Build from Source”go install github.com/sagarc03/stowry/cmd/stowry-cli@latestConfiguration
Section titled “Configuration”The client supports multiple server profiles, allowing you to easily switch between different Stowry servers.
Configuration Priority
Section titled “Configuration Priority”Settings are resolved in this order (highest to lowest priority):
- Command-line flags (
--endpoint,--access-key,--secret-key) - Environment variables (
STOWRY_ENDPOINT,STOWRY_ACCESS_KEY,STOWRY_SECRET_KEY) - Selected profile (
--profileflag orSTOWRY_PROFILEenv var) - Default profile from config file
Configuration File
Section titled “Configuration File”Create ~/.stowry/config.yaml with one or more profiles:
profiles: - name: local endpoint: http://localhost:5708 access_key: YOUR_LOCAL_ACCESS_KEY secret_key: YOUR_LOCAL_SECRET_KEY default: true
- name: production endpoint: https://storage.example.com access_key: YOUR_PROD_ACCESS_KEY secret_key: YOUR_PROD_SECRET_KEY
- name: staging endpoint: https://staging.example.com access_key: YOUR_STAGING_ACCESS_KEY secret_key: YOUR_STAGING_SECRET_KEYThe first profile is used as default, unless one is marked with default: true.
Using Profiles
Section titled “Using Profiles”# Uses default profilestowry-cli upload ./file.txt
# Use a specific profilestowry-cli --profile production upload ./file.txtstowry-cli -p staging list
# Set profile via environment variableexport STOWRY_PROFILE=productionstowry-cli upload ./file.txtEnvironment Variables
Section titled “Environment Variables”export STOWRY_PROFILE=production # Select profile by nameexport STOWRY_CONFIG=~/.stowry/config.yaml # Custom config file pathexport STOWRY_ENDPOINT=http://localhost:5708 # Override server URLexport STOWRY_ACCESS_KEY=YOUR_ACCESS_KEY # Override access keyexport STOWRY_SECRET_KEY=YOUR_SECRET_KEY # Override secret keyCommand-line Overrides
Section titled “Command-line Overrides”Flags override both profile and environment settings:
stowry-cli --profile production --endpoint https://backup.example.com upload ./file.txtGlobal Flags
Section titled “Global Flags”These flags are available for all commands:
| Flag | Short | Env Var | Default | Description |
|---|---|---|---|---|
--config | -c | STOWRY_CONFIG | ~/.stowry/config.yaml | Config file path |
--profile | -p | STOWRY_PROFILE | - | Use named profile from config |
--endpoint | -e | STOWRY_ENDPOINT | http://localhost:5708 | Endpoint URL override |
--access-key | -a | STOWRY_ACCESS_KEY | - | Access key override |
--secret-key | -k | STOWRY_SECRET_KEY | - | Secret key override |
--json | - | - | false | Output results as JSON |
--quiet | -q | - | false | Suppress non-essential output |
--help | -h | - | - | Help for the command |
Commands
Section titled “Commands”configure
Section titled “configure”Manage server profiles in the configuration file.
stowry-cli configure <subcommand>Subcommands:
| Subcommand | Description |
|---|---|
list | List all configured profiles |
add <name> | Add a new profile interactively |
update <name> | Update an existing profile interactively |
remove <name> | Remove a profile |
set-default <name> | Set the default profile |
show [name] | Show profile details (default profile if name omitted) |
Flags for add and update:
| Flag | Default | Description |
|---|---|---|
--skip-test | false | Skip connection test before saving |
Examples:
# List all profiles (* marks default)stowry-cli configure list
# Add a new profile interactivelystowry-cli configure add production
# Add profile without testing connectionstowry-cli configure add staging --skip-test
# Update an existing profilestowry-cli configure update production
# Update profile without testing connectionstowry-cli configure update production --skip-test
# Show profile details (secrets hidden)stowry-cli configure show production
# Show profile with secrets revealedstowry-cli configure show production --show-secrets
# Set default profilestowry-cli configure set-default production
# Remove a profilestowry-cli configure remove old-serverOutput of configure list:
NAME ENDPOINT ACCESS KEY ---------- --------------------------- --------------------* local http://localhost:5708 AKIA...MPLE production https://storage.example.com PROD...KEYupload
Section titled “upload”Upload files to the server.
stowry-cli upload [flags] <local-path> [remote-path]If remote-path is omitted, the local path is used (normalized):
./foo/bar.txt→foo/bar.txt/abs/path/file.txt→abs/path/file.txt../sibling/file.txt→sibling/file.txt
Flags:
| Flag | Short | Default | Description |
|---|---|---|---|
--recursive | -r | false | Upload directory recursively |
--content-type | -t | auto-detect | Override content type |
Examples:
# Upload using local path as remote pathstowry-cli upload ./document.pdf
# Upload nested file (preserves directory structure)stowry-cli upload ./images/photo.jpg
# Upload with explicit remote pathstowry-cli upload ./document.pdf reports/2024/report.pdf
# Upload with explicit content typestowry-cli upload --content-type application/json ./data.json
# Upload a directory recursivelystowry-cli upload -r ./images/
# Upload directory to different remote prefixstowry-cli upload -r ./local/images/ remote/media/
# Upload with JSON outputstowry-cli upload --json ./file.txtOutput:
uploaded path/file.txt (1234 bytes)With --json:
[ { "local_path": "./file.txt", "remote_path": "path/file.txt", "size": 1234, "content_type": "text/plain" }]download
Section titled “download”Download a file from the server.
stowry-cli download [flags] <remote-path> [local-path]Flags:
| Flag | Short | Default | Description |
|---|---|---|---|
--output | -o | - | Output file path |
--stdout | - | false | Write content to stdout |
Examples:
# Download to current directory (uses remote filename)stowry-cli download path/file.txt
# Download to specific local pathstowry-cli download path/file.txt ./local-copy.txt
# Download using --output flagstowry-cli download -o ./local-copy.txt path/file.txt
# Pipe to another commandstowry-cli download --stdout config.json | jq .
# Download with JSON metadata outputstowry-cli download --json path/file.txtOutput:
downloaded path/file.txt -> ./file.txt (1234 bytes)With --stdout, the file content is written directly to stdout, making it easy to pipe to other commands.
delete
Section titled “delete”Delete one or more files from the server.
stowry-cli delete [flags] <remote-path> [remote-path...]Examples:
# Delete a single filestowry-cli delete path/file.txt
# Delete multiple filesstowry-cli delete old/a.txt old/b.txt old/c.txt
# Delete with quiet modestowry-cli delete -q temp/file.txt
# Delete with JSON outputstowry-cli delete --json path/file.txtOutput:
deleted path/file.txtWith --json:
[ { "path": "path/file.txt", "deleted": true }]List objects on the server.
stowry-cli list [flags] [prefix]Note: This command only works when the server is running in store mode. In static or spa modes, this will return a 404 error.
Flags:
| Flag | Short | Default | Description |
|---|---|---|---|
--prefix | - | - | Filter by path prefix |
--limit | -l | 100 | Maximum results per page (max: 1000) |
--all | - | false | Fetch all pages |
--cursor | - | - | Pagination cursor for next page |
Examples:
# List all objectsstowry-cli list
# List with prefix (positional argument)stowry-cli list images/
# List with prefix (flag)stowry-cli list --prefix documents/
# Limit resultsstowry-cli list --limit 10
# Fetch all pagesstowry-cli list --all
# Continue from cursorstowry-cli list --cursor "eyJwYXRoIjoi..."
# JSON outputstowry-cli list --json --prefix images/Output:
images/photo1.jpg image/jpeg 102400 2024-01-15T10:00:00Zimages/photo2.jpg image/jpeg 204800 2024-01-15T11:00:00Zimages/photo3.jpg image/jpeg 153600 2024-01-15T12:00:00Z
Next cursor: eyJwYXRoIjoi...With --json:
{ "items": [ { "path": "images/photo1.jpg", "content_type": "image/jpeg", "file_size_bytes": 102400, "created_at": "2024-01-15T10:00:00Z", "updated_at": "2024-01-15T10:00:00Z" } ], "next_cursor": "eyJwYXRoIjoi..."}Exit Codes
Section titled “Exit Codes”| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | Error (authentication failed, file not found, server error, etc.) |
Examples
Section titled “Examples”Basic Workflow
Section titled “Basic Workflow”# Configure credentialsexport STOWRY_ENDPOINT=http://localhost:5708export STOWRY_ACCESS_KEY=your-access-keyexport STOWRY_SECRET_KEY=your-secret-key
# Upload a file (uses local path as remote path)stowry-cli upload ./documents/report.pdf
# Upload with explicit remote pathstowry-cli upload ./report.pdf documents/2024/report.pdf
# List filesstowry-cli list documents/
# Download a filestowry-cli download documents/report.pdf ./downloaded-report.pdf
# Delete when donestowry-cli delete documents/report.pdfBatch Operations
Section titled “Batch Operations”# Upload entire directory (preserves structure)stowry-cli upload -r ./website/
# Upload directory to different prefixstowry-cli upload -r ./website/ static/
# Delete multiple filesstowry-cli delete static/old1.html static/old2.html static/old3.htmlScripting with JSON Output
Section titled “Scripting with JSON Output”# Get file countstowry-cli list --json --all | jq '.items | length'
# Get total sizestowry-cli list --json --all | jq '[.items[].file_size_bytes] | add'
# Filter by content typestowry-cli list --json --all | jq '.items[] | select(.content_type == "image/jpeg")'Using Profiles
Section titled “Using Profiles”# Set up profiles interactivelystowry-cli configure add localstowry-cli configure add productionstowry-cli configure add staging
# Set production as defaultstowry-cli configure set-default production
# Use default profile (production)stowry-cli upload ./file.txt
# Use specific profilestowry-cli -p staging upload ./file.txt
# CI/CD: Set profile via environmentexport STOWRY_PROFILE=productionstowry-cli upload ./dist/See Also
Section titled “See Also”- Server CLI Reference - Commands for running and managing the Stowry server
- Client SDKs - Programmatic access with Go, Python, and JavaScript
- Authentication - Understanding presigned URLs and authentication