Adapter

DigitalOcean Spaces

Overview

DigitalOcean Spaces is S3-compatible. This adapter is a thin wrapper over @storagesdk/adapters/s3 with Spaces defaults baked in — the endpoint is built from your region, and the rest of the surface is identical to the S3 adapter.

Configuration

import { Storage } from '@storagesdk/core';
import { spaces } from '@storagesdk/adapters/spaces';

const storage = new Storage({
  adapter: spaces({
    bucket: 'photos',
    region: 'nyc3',
    accessKeyId: process.env.DO_SPACES_KEY!,
    secretAccessKey: process.env.DO_SPACES_SECRET!,
  }),
});
spaces({
  bucket: string;            // Space the adapter operates on (must already exist)
  region: string;            // e.g. 'nyc3', 'ams3', 'sgp1', 'sfo3', 'fra1', 'syd1', 'blr1'
  accessKeyId: string;       // Spaces access key
  secretAccessKey: string;   // Spaces secret
  endpoint?: string;         // override; defaults to `https://<region>.digitaloceanspaces.com`
});

Create a Spaces key in the DigitalOcean dashboard → APISpaces Keys. The secret is shown only once.

Notes