Skip to content
Auto
Products

S3 file system

This file system provides an implementation for the file system based on Amazon S3 (or any S3-compatible storage), using the official AWSSDK.S3 client library.

Because S3 has no real directories - they are simulated using key prefixes - the file system does not report FileSystemFeatures.HierarchicalDirectories. An empty directory cannot be represented.

Amazon S3:

var serviceUrl = "https://s3.eu-central-1.amazonaws.com";
var accessKey = "accessKey";
var secretKey = "secretKey";
var bucketName = "my-bucket";
using var fileSystem = TagBites.IO.S3.S3FileSystem.Create(serviceUrl, accessKey, secretKey, bucketName);
// ... using like standard file system

R2 exposes an S3-compatible API, so a dedicated factory method builds the correct service URL from your Cloudflare account id:

var accountId = "accountId";
var accessKey = "accessKey";
var secretKey = "secretKey";
var bucketName = "my-bucket";
using var fileSystem = TagBites.IO.S3.S3FileSystem.CreateCloudflareR2FileSystem(accountId, accessKey, secretKey, bucketName);
// ... using like standard file system
  • Asynchronous operations. Synchronous calls run on top of them.
  • Metadata: none.
  • Object storage: a directory exists only as a prefix of an object key (no FileSystemFeatures.HierarchicalDirectories), so an empty directory cannot be represented.
  • The ETag of a multipart upload is not an MD5 hash and is not reported as one.

Full implementation on github: TagBites.IO.S3.