4 releases (stable)

1.0.2 May 30, 2021
1.0.1 Apr 16, 2021
0.0.1 Apr 15, 2021

#3 in #wasabi

MIT license

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 -h for 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

  • -q is the URL for broker
  • -w is 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-bucket in us-east-1 to my-wasabi-bucket in wa-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

~14–25MB
~374K SLoC