Skip to main content

Creating Folders

Organize your R2 bucket by creating virtual folders:
1

Click the + button

Opens the upload/actions menu in the toolbar
2

Select New Folder…

Opens the folder creation dialog
3

Enter folder name

Type a name (e.g., photos, documents, 2024-backups)
4

Click Create

The folder appears immediately in the current directory
Folders in R2 are virtual — they’re represented by zero-byte objects with a trailing slash (e.g., photos/).
Implementation: BrowserView.swift:502-527 (source: Fiaxe/Views/BrowserView.swift:502-527)

Folder Naming Rules

  • Must not be empty (after trimming whitespace)
  • Can contain letters, numbers, hyphens, underscores
  • Avoid special characters that require URL encoding
  • The app automatically appends a trailing / if needed
Source: R2BrowseService.swift:88-110 (source: Fiaxe/Services/R2BrowseService.swift:88-110)

Deleting Files and Folders

Remove files and folders permanently from your R2 bucket.
Deletions are permanent and cannot be undone. r2Vault does not have a trash or recycle bin.

Delete a Single File

  1. Right-click the file
  2. Select Delete
  3. Confirm in the dialog:
Delete "photo.jpg"?

This will permanently remove the file from R2.
This cannot be undone.

[Delete]  [Cancel]

Delete Multiple Files (Batch Delete)

Use multi-select to delete several files at once:
1

Select files

Click files one by one to add them to the selection, or use Select All from the toolbar
2

Open the selection menu

Click the icon in the toolbar
3

Choose Delete Selected

Or click Delete Selected in the status bar at the bottom
4

Confirm

The confirmation dialog shows the count:
Delete 8 items?

This will permanently remove the selected items
from R2 and cannot be undone. Folders will be
deleted recursively including all their contents.

[Delete]  [Cancel]
Batch deletions run concurrently for speed. Files and folders are deleted in parallel.
Implementation: AppViewModel.swift:313-333 (source: Fiaxe/ViewModels/AppViewModel.swift:313-333)

Recursive Folder Deletion

Deleting a folder removes all files and subfolders inside it.

How It Works

1

User initiates delete

Right-click a folder and select Delete Folder & Contents
2

Confirmation dialog

Shows a warning:
Delete "vacation" and all its contents?

This will permanently delete the folder and all
files inside it from R2. This cannot be undone.

[Delete Folder & Contents]  [Cancel]
3

Recursive enumeration

r2Vault calls listAllKeys() to get every object key under the folder prefix (no delimiter)
4

Concurrent deletion

All keys are deleted in parallel using withThrowingTaskGroup
5

Browser refresh

The current folder view reloads to reflect the changes
If the folder contains thousands of files, deletion may take several seconds. There is no progress indicator for individual deletions within a folder.
Source:
  • Recursive deletion logic: AppViewModel.swift:336-347 (source: Fiaxe/ViewModels/AppViewModel.swift:336-347)
  • List all keys: R2BrowseService.swift:115-155 (source: Fiaxe/Services/R2BrowseService.swift:115-155)

Example: Deleting a Nested Folder

vacation/
├── photos/
│   ├── beach.jpg
│   ├── sunset.png
│   └── family/
│       ├── group.jpg
│       └── kids.jpg
└── videos/
    └── drone.mp4
Deleting vacation/ removes:
  • vacation/photos/beach.jpg
  • vacation/photos/sunset.png
  • vacation/photos/family/group.jpg
  • vacation/photos/family/kids.jpg
  • vacation/videos/drone.mp4
  • vacation/photos/family/ (folder marker)
  • vacation/photos/ (folder marker)
  • vacation/videos/ (folder marker)
  • vacation/ (folder marker)

Presigned URL Generation

Generate temporary download URLs for private files.
Presigned URLs allow read-only access to R2 objects for a limited time without exposing your credentials.

Generate a Presigned URL

  1. Right-click a file
  2. Select Copy URL
  3. The presigned URL is copied to clipboard

Presigned URL Format

Generated URLs include AWS Signature V4 query parameters:
https://<account>.r2.cloudflarestorage.com/<bucket>/<key>?
  X-Amz-Algorithm=AWS4-HMAC-SHA256&
  X-Amz-Credential=<access-key>%2F<date>%2Fauto%2Fs3%2Faws4_request&
  X-Amz-Date=<timestamp>&
  X-Amz-Expires=3600&
  X-Amz-SignedHeaders=host&
  X-Amz-Signature=<signature>
X-Amz-Expires
number
default:"3600"
Expiration time in seconds (default: 1 hour)
Implementation: AWSV4Signer.swift (source: Fiaxe/Services/AWSV4Signer.swift)

Use Cases for Presigned URLs

Share privately

Share a file with someone without making the entire bucket public

Download from browser

Paste the URL in a browser to download the file directly

Embed in apps

Use in <img> tags, <video> tags, or API responses

Quick Look preview

r2Vault uses presigned URLs to stream files for preview without local download

Public vs. Presigned URLs

TypeWhen to UseExample
Public URLCustom domain configured, bucket is publichttps://cdn.example.com/photo.jpg
Presigned URLNo custom domain, or bucket is privatehttps://abc.r2.cloudflarestorage.com/bucket/photo.jpg?X-Amz-...
r2Vault auto-copies public URLs after upload if you have a custom domain configured. Use presigned URLs for secure, time-limited access.

File Operations Reference

Supported Operations

OperationMethodAPI Call
Create folderPUTPUT /<bucket>/<folder>/ with Content-Length: 0
Delete fileDELETEDELETE /<bucket>/<key>
Delete folderDELETE (recursive)List all keys with prefix, then batch DELETE
Generate presigned URLSignatureAWS SigV4 with query parameters
Copy URLRead-onlyConstructs URL from credentials + key

API Compatibility

r2Vault uses the S3-compatible API provided by Cloudflare R2:
  • Endpoint: https://<account>.r2.cloudflarestorage.com
  • Authentication: AWS Signature Version 4 (HMAC-SHA256)
  • Supported operations: GET, PUT, DELETE, HEAD, ListObjectsV2
Source:
  • R2BrowseService.swift (source: Fiaxe/Services/R2BrowseService.swift)
  • R2UploadService.swift (source: Fiaxe/Services/R2UploadService.swift)
  • AWSV4Signer.swift (source: Fiaxe/Services/AWSV4Signer.swift)

Next Steps