4 releases (stable)
| 1.0.2 | May 30, 2021 |
|---|---|
| 1.0.1 | Apr 16, 2021 |
| 0.0.1 | Apr 15, 2021 |
#7 in #wasabi
28KB
366 lines
Zn - CLI for Files (Cloud Storage)
Purpose
This application is a CLI for files - a CDN Origin Server for Cloud Storage.
Zn makes it easy to upload a directory to a bucket, download a bucket to a directory, and copy buckets between cloud providers.
Zn in the future will support lumber to allow shipping logs from cloud storage to portal for search indexing.
To use this service you need to be running both a broker and a files server.
Features
- Very performant with almost no CPU and memory usage
- Supports uploading a directory to a bucket
- Supports downloading a bucket to a directory
- Supports copying between buckets including between providers
- Under 500 lines of code
- Built on broker and files
Use
cargo install zn
-
Refer to
zn -hfor help -
Valid regions are:
| Provider | Region |
|---|---|
| wasabi | wa-us-east-1 |
| wasabi | wa-us-east-2 |
| wasabi | wa-us-west-1 |
| wasabi | wa-eu-central-1 |
| aws | us-east-1 |
| aws | us-east-2 |
| aws | us-west-1 |
| aws | us-west-2 |
| aws | ca-central-1 |
| aws | ap-south-1 |
| aws | ap-northeast-1 |
| aws | ap-northeast-2 |
| aws | ap-northeast-3 |
| aws | cn-north-1 |
| aws | cn-northwest-1 |
| aws | eu-north-1 |
| aws | eu-central-1 |
| aws | eu-west-1 |
| aws | eu-west-2 |
| aws | eu-west-3 |
| aws | me-south-1 |
| aws | sa-east-1 |
| do | nyc3 |
| do | ams3 |
| do | spg1 |
| do | fra1 |
| vultr | ewr1 |
| yandex | ru-central1 |
Examples
-qis the URL for broker-wis the URL for files
Upload a directory to a bucket
zn -u="/home/me/upload_data" -a="us-east-1" -j="my-bucket" -r="user" -p="password" -q="https://broker.upbase.dev" -w="https://files.upbase.dev"
Download a bucket to a directory
zn -d="/home/me/download_data" -b="us-east-1" -k="my-bucket" -r="user" -p="password" -q="https://broker.upbase.dev" -w="https://files.upbase.dev"
Copy the files of a bucket to another bucket - including between providers
- This will copy the files in your
my-aws-bucketinus-east-1tomy-wasabi-bucketinwa-us-east-1
zn -a="wa-us-east-1" -b="us-east-1" -j="my-wasabi-bucket" -k="my-aws-bucket" -r="user" -p="password" -q="https://broker.upbase.dev" -w="https://files.upbase.dev"
TechStack
Dependencies
~12–20MB
~370K SLoC