Guide

Metadata & Lifecycle

User metadata, result metadata, object tagging, and expiration

User metadata (options.metadata)

Pass a Record<string, string> on upload:

const result = await client.upload(stream, {
  filename: "photo.jpg",
  metadata: {
    userId: "1234",
    license: "cc-by-4.0",
  },
});
DriverBehavior
S3DriverSends metadata as signed x-amz-meta-* request headers, so it is persisted as S3 user metadata.
GCSDriverStored as custom object metadata.
AzureDriverStored as x-ms-meta-* blob metadata. Keys must be letters, digits and underscores (no hyphens).
SupabaseDriverStored as the object's user metadata.
LocalDriverMetadata is not persisted yet (persistence is in the works).
CloudinaryDriverMetadata is not sent yet (support is in the works).

Result metadata (result.meta)

Each driver returns its own typed metadata:

Drivermeta shape
LocalDriverLocalMeta: { localPath: string }
S3DriverS3Meta: { bucket: string; etag?: string }
GCSDriver{ bucket: string; generation?: string; md5Hash?: string; etag?: string }
AzureDriver{ container: string; etag?: string }
SupabaseDriver{ bucket: string; etag?: string }
CloudinaryDriver{ publicId, version, format, resourceType, bytes, secureUrl, width?, height? }

Object tagging

In the works. S3 object tags (x-amz-tagging) are being added. Until then, put tags in options.metadata or track them in your own database.

Lifecycle & Expiration

In the works. TTL/expiration on uploads and lifecycle rule management are being added to the core contract.

  • S3 lifecycle rules (e.g. "delete after 30 days") are bucket-level configuration and are not yet exposed by Fileway. Configure them in the AWS console, Terraform, or via the AWS SDK directly.
  • Cloudinary has no automatic expiry for stored assets; getPresignedUrl limits how long a link works, not how long the asset is kept.
  • Local has no built-in cleanup yet; a scheduled sweep is in the works.

Was this page helpful?

On this page