S3Client

public protocol S3Client : AnyObject

S3 client wrapper protocol mainly used for providing an abstraction layer on top of AWS S3 SDK.

  • Uploads a blob to AWS S3.

    Throws

    S3ClientError

    Declaration

    Swift

    func upload(data: Data, contentType: String, bucket: String, key: String) async throws

    Parameters

    data

    Blob to upload.

    contentType

    Content type of the blob.

    bucket

    Name of S3 bucket to store the blob.

    key

    S3 key to be associated with the blob.

  • download(bucket:key:) Asynchronous

    Downloads a blob from AWS S3.

    Throws

    S3ClientError

    Declaration

    Swift

    func download(bucket: String, key: String) async throws -> Data

    Parameters

    bucket

    Name of S3 bucket to storing the blob.

    key

    S3 key associated with the blob.

    Return Value

    The data in the bucket

  • delete(bucket:key:) Asynchronous

    Deletes a blob stored AWS S3.

    Throws

    S3ClientError

    Declaration

    Swift

    func delete(bucket: String, key: String) async throws

    Parameters

    bucket

    Name of S3 bucket to storing the blob.

    key

    S3 key associated with the blob.