AnyMux

S3 API reference

Exports of @anymux/s3. Back to the module

Classes

S3ObjectStorage

class
class S3ObjectStorage

constructor

constructor
constructor(config: S3Config): S3ObjectStorage

listBuckets

method
listBuckets(): Promise<BucketInfo[]>

createBucket

method
createBucket(name: string): Promise<void>

deleteBucket

method
deleteBucket(name: string): Promise<void>

bucketExists

method
bucketExists(name: string): Promise<boolean>

getObject

method
getObject(bucket: string, key: string): Promise<Buffer>

putObject

method
putObject(bucket: string, key: string, data: Buffer | Uint8Array | string, options?: PutObjectOptions): Promise<void>

deleteObject

method
deleteObject(bucket: string, key: string): Promise<void>

headObject

method
headObject(bucket: string, key: string): Promise<ObjectMetadata>

copyObject

method
copyObject(sourceBucket: string, sourceKey: string, destBucket: string, destKey: string): Promise<void>

listObjects

method
listObjects(bucket: string, options?: ListObjectsOptions): Promise<ListObjectsResult>

getPresignedUrl

method
getPresignedUrl(bucket: string, key: string, options?: PresignedUrlOptions): Promise<string>

objectExists

method
objectExists(bucket: string, key: string): Promise<boolean>

S3Provider

class
class S3Provider

id

property
id: string

name

property
name: "Amazon S3"

capabilities

property
capabilities: readonly CapabilityType[]

constructor

constructor
constructor(options: S3ProviderOptions): S3Provider

getCapability

method
<T>(type: CapabilityType): T | undefined

hasCapability

method
hasCapability(type: CapabilityType): boolean

Types

S3Config

type
type S3Config = { region?: string; endpoint?: string; credentials?: { accessKeyId?: string; secretAccessKey?: string; }; forcePathStyle?: boolean; bucket?: string; }

Interfaces

S3ProviderOptions

interface
interface S3ProviderOptions

id

property
id: string

config

property
config: { region?: string; endpoint?: string; credentials?: { accessKeyId?: string; secretAccessKey?: string; }; forcePathStyle?: boolean; bucket?: string; }

Constants

S3ConfigSchema

const
const S3ConfigSchema: z.ZodObject<{ region: z.ZodString; endpoint: z.ZodOptional<z.ZodString>; credentials: z.ZodOptional<z.ZodObject<{ accessKeyId: z.ZodString; secretAccessKey: z.ZodString; }, "strip", z.ZodTypeAny, { accessKeyId?: string; secretAccessKey?: string; }, { accessKeyId?: string; secretAccessKey?: string; }>>; forcePathStyle: z.ZodOptional<z.ZodBoolean>; bucket: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { region?: string; endpoint?: string; credentials?: { accessKeyId?: string; secretAccessKey?: string; }; forcePathStyle?: boolean; bucket?: string; }, { region?: string; endpoint?: string; credentials?: { accessKeyId?: string; secretAccessKey?: string; }; forcePathStyle?: boolean; bucket?: string; }>