Class AWSS3Service

main service implement.

Hierarchy

  • AWSS3Service

Implements

  • CoreS3Service

Constructors

Properties

DEF_S3_BUCKET: string = 'lemon-hello-www'

default bucket name

ENV_S3_NAME: string = 'MY_S3_BUCKET'

environ name to use bucket

Methods

  • get target endpoint by name.

    Parameters

    • Optional target: string

    Returns string

  • delete object from bucket

    Parameters

    • key: string

    Returns Promise<void>

  • return decoded Object from bucket file.

    Type Parameters

    • T = object

    Parameters

    • key: string

      ex) 'hello-0001.json' , 'dist/hello-0001.json

    Returns Promise<T>

  • get a file from S3 Bucket

    Parameters

    • key: string

    Returns Promise<GetObjectResult>

  • get tag-set of object

    Parameters

    • key: string

    Returns Promise<TagSet>

  • retrieve metadata without returning the object

    Returns

    metadata object / null if not exists

    Parameters

    • key: string

    Returns Promise<HeadObjectResult>

  • list objects in bucket

    Parameters

    • Optional options: { delimiter?: string; limit?: number; nextToken?: string; prefix?: string; throwable?: boolean; unlimited?: boolean }
      • Optional delimiter?: string

        use to group keys

      • Optional limit?: number

        maximum number of keys returned in single request (default 10, max 1000)

      • Optional nextToken?: string

        same as NextContinuationToken

      • Optional prefix?: string

        keys that begin with the specified prefix.

      • Optional throwable?: boolean

        (optional) flag to throw error if error, or see .error in result

      • Optional unlimited?: boolean

        flag to read all keys (each request contains limit)

    Returns Promise<ListObjectResult>

  • upload a file to S3 Bucket

    const res = $s3.putObject(JSON.stringify({ message }), 'test.json');
    // response would be like
    {
    "Bucket": "lemon-hello-www",
    "ETag": "5e206.....8bd4c",
    "Key": "test.json",
    "Location": "https://lemon-hello-www.s3.ap-northeast-2.amazonaws.com/test.json",
    }

    Parameters

    • content: string | Buffer

      content body

    • Optional key: string

      (optional) S3 key to put

    • Optional metadata: Metadata

      (optional) metadata to store

    • Optional tags: TagSet

      (optional) tag set

    Returns Promise<PutObjectResult>

Generated using TypeDoc