CLI

Downloads

Download files using the Shelby CLI

Overview

The Shelby CLI provides simple operations for downloading files from the Shelby network.

It is important that the CLI is properly configured with a network and funded account. If not, please visit the Getting Started quick start guide for more information.

shelby download

Currently you cannot download blobs that were uploaded by other accounts with the CLI. This will be fixed in the near future.

Download a file (or files) from the Shelby network, with progress reporting, for the active account.

shelby download [options] <src> <dst>

Options

FlagAliasTypeRequiredDescription
--recursive-rflagTreat src as a directory prefix. Both the src and dst must end with /.
--force-fflagOverwrite existing files or clear a non-empty directory before downloading.

The downloader validates filesystem state before fetching data. Create the parent directory ahead of time and supply --force if you need to overwrite existing content.

If downloading a single blob, <src> must be a valid blob name (does not end in /). The <dst> must not end in a directory separator and will be created as a file.

When downloading a directory recursively, both <src> and <dst> must end in /. The <dst> directory will be created if it doesn't exist.

Validation Rules:

  • The parent directory of <dst> must already exist
  • Without --force, the dst file must not exist, or must be an empty directory for recursive downloads
  • With --force, any existing dst will be completely removed before download

Basic example

shelby download shelby/blob/name.mp4 ./video.mp4

Force Overwrite

shelby download shelby/blob/name.mp4 ./existing-video.mp4 --force

Directory Download

shelby download -r shelby/blobs/best-videos/hls_video/ ./hls_video/
shelby download --recursive my-site/ ./website/

For recursive downloads, both src (the blob prefix) and dst (the target directory) must end with /.

Canonical Directory Layout

When downloading directories, the command recreates the directory structure locally.

If Shelby contains these blobs:

my-files/document.pdf
my-files/images/photo1.jpg
my-files/images/photo2.jpg

Running:

shelby download -r my-files/ ./local-files/

Will create:

$ tree ./local-files/
./local-files/
├── document.pdf
└── images/
    ├── photo1.jpg
    └── photo2.jpg

The download command automatically creates any necessary subdirectories and downloads all files.

Other Account's Files

For now, the CLI only interacts with active account in the CLI's context.

Files from other accounts are downloadable using the REST interface from the RPC node, which currently does not require any additional headers or session information for payment.

In general:

curl https://api.shelbynet.shelby.xyz/shelby/v1/blobs/<account>/<blob-name>

For example, if I want to download the blob foo stored by account 0x89ca7dfadf5788830b0d5826a56b370ced0d7938c4628f4b57f346ab54f76357 I can use:

curl https://api.shelbynet.shelby.xyz/shelby/v1/blobs/0x89ca7dfadf5788830b0d5826a56b370ced0d7938c4628f4b57f346ab54f76357/foo