s6.app.r2 package¶

Submodules¶

s6.app.r2.delete module¶

Delete a single object or all objects under a prefix.

Usage¶

s6 r2 delete <key-or-prefix> [-r|–recursive] [-b BUCKET] [-e ENDPOINT]

Behavior¶

  • Without --recursive: deletes exactly one object at <key-or-prefix>.

  • With --recursive or when <key-or-prefix> ends with ‘/’: deletes all objects under the prefix.

s6.app.r2.delete.main() None¶

s6.app.r2.download module¶

Download a single object or all objects under a prefix.

Usage¶

s6 r2 download <object-or-prefix> [-o DIR] [-b BUCKET] [-e ENDPOINT]

Behavior¶

  • If the argument ends with ‘/’, it is treated as a prefix and the entire subtree is downloaded into DIR preserving structure.

  • Otherwise the command tries to resolve whether the key is an object; if a matching object exists, it downloads to DIR/<key> creating parents. If no exact object match is found but objects exist under the key as a prefix, it downloads the subtree instead.

s6.app.r2.download.main() None¶

s6.app.r2.list module¶

List R2/S3 objects under an optional prefix.

Usage¶

s6 r2 list [prefix] [-b BUCKET] [-e ENDPOINT] [–flat]

Examples

  • List all objects:

    s6 r2 list -b assets -e https://<acct>.r2.cloudflarestorage.com

  • List under a prefix (recursively):

    s6 r2 list data/train/ -b assets -e https://…

  • One level only (show prefixes too):

    s6 r2 list data/ –flat -b assets -e https://…

s6.app.r2.list.main() None¶

s6.app.r2.test module¶

s6.app.r2.test.collect_files(base: Path) dict¶
s6.app.r2.test.delete_prefix(client: R2Client, prefix: str) int¶
s6.app.r2.test.main() int¶
s6.app.r2.test.make_sample_dir(base: Path) dict¶

s6.app.r2.upload module¶

Upload a file or directory to R2.

Usage¶

s6 r2 upload <local-path> <dest-key-or-prefix> [-b BUCKET] [-e ENDPOINT] [–overwrite]

Behavior¶

  • If <local-path> is a file: - When <dest-key-or-prefix> ends with ‘/’, the file is uploaded as

    <dest-key-or-prefix>/<basename>.

    • Otherwise it is uploaded exactly as the provided key.

  • If <local-path> is a directory, its contents are uploaded recursively under the destination prefix, preserving relative paths. In this case the destination is treated as a prefix; if it does not end with ‘/’, one is appended for convenience.

s6.app.r2.upload.main() None¶

Module contents¶