@aws-amplify/storage

  • Version 4.3.6
  • Published
  • 9.21 MB
  • 8 dependencies
  • Apache-2.0 license

Install

npm i @aws-amplify/storage
yarn add @aws-amplify/storage
pnpm add @aws-amplify/storage

Overview

Storage category of aws-amplify

Index

Variables

variable Storage

const Storage: StorageClass;

    Classes

    class AWSS3Provider

    class AWSS3Provider implements StorageProvider {}
    • Provide storage methods to use AWS S3

    constructor

    constructor(config?: StorageOptions);
    • Initialize Storage with AWS configurations

      Parameter config

      Configuration object for storage

    property CATEGORY

    static readonly CATEGORY: string;

      property PROVIDER_NAME

      static readonly PROVIDER_NAME: string;

        method configure

        configure: (config?: any) => object;
        • Configure Storage part with aws configuration

          Parameter config

          Configuration of the Storage {Object} - Current configuration

        method copy

        copy: (
        src: S3CopySource,
        dest: S3CopyDestination,
        config?: S3ProviderCopyConfig
        ) => Promise<S3ProviderCopyOutput>;
        • Copy an object from a source object to a new object within the same bucket. Can optionally copy files across different level or identityId (if source object's level is 'protected').

          Parameter src

          Key and optionally access level and identityId of the source object.

          Parameter dest

          Key and optionally access level of the destination object.

          Parameter config

          Optional configuration for s3 commands. {Promise} The key of the copied object.

        method get

        get: <T extends S3ProviderGetConfig & StorageOptions>(
        key: string,
        config?: T
        ) => Promise<S3ProviderGetOuput<T>>;
        • Get a presigned URL of the file or the object data when download:true

          Parameter key

          key of the object

          Parameter config

          Optional configuration for the underlying S3 command {Promise<string | GetObjectCommandOutput>} - A promise resolves to Amazon S3 presigned URL or the GetObjectCommandOutput if download is set to true on success

        method getCategory

        getCategory: () => string;
        • get the category of the plugin

        method getProviderName

        getProviderName: () => string;
        • get provider name of the plugin

        method list

        list: (
        path: string,
        config?: S3ProviderListConfig
        ) => Promise<S3ProviderListOutput>;
        • List bucket objects relative to the level and prefix specified

          Parameter path

          the path that contains objects

          Parameter config

          Optional configuration for the underlying S3 command {Promise} - Promise resolves to list of keys, eTags, lastModified and file size for all objects in path

        method put

        put: (
        key: string,
        object: any,
        config?: S3ProviderPutConfig
        ) => Promise<S3ProviderPutOutput>;
        • Put a file in S3 bucket specified to configure method

          Parameter key

          key of the object

          Parameter object

          File to be put in Amazon S3 bucket

          Parameter config

          Optional configuration for the underlying S3 command {Promise} - promise resolves to an object with the new object's key on success

        method remove

        remove: (
        key: string,
        config?: S3ProviderRemoveConfig
        ) => Promise<S3ProviderRemoveOutput>;
        • Remove the object for specified key

          Parameter key

          key of the object

          Parameter config

          Optional configuration for the underlying S3 command {Promise} - Promise resolves upon successful removal of the object

        class StorageClass

        class Storage {}
        • Provide storage methods to use AWS S3

        constructor

        constructor();
        • Initialize Storage

          Parameter config

          Configuration object for storage

        property vault

        vault: Storage;
        • Modifiers

          • @public

        method addPluggable

        addPluggable: (pluggable: StorageProvider) => {};
        • add plugin into Storage category

          Parameter pluggable

          an instance of the plugin

        method cancel

        cancel: (request: Promise<any>, message?: string) => void;
        • Cancels an inflight request

          Parameter request

          The request to cancel

          Parameter message

          A message to include in the cancelation exception

        method configure

        configure: (config?: any) => any;
        • Configure Storage

          Parameter config

          Configuration object for storage {Object} - Current configuration

        method copy

        copy: (
        src: StorageCopySource,
        dest: StorageCopyDestination,
        config?: any
        ) => Promise<any>;
        • Copies a file from the src key to dest key.

          Parameter src

          key of the source object.

          Parameter dest

          key of the destination object.

          Parameter config

          config. {Promise} - A promise resolves to the copied object's key.

        method get

        get: (key: string, config?: any) => Promise<String | Object>;
        • Get a presigned URL of the file or the object data when download:true

          Parameter key

          key of the object

          Parameter config

          - A promise resolves to either a presigned url or the object

        method getModuleName

        getModuleName: () => string;

          method getPluggable

          getPluggable: (providerName: string) => StorageProvider;
          • Get the plugin object

            Parameter providerName

            the name of the plugin

          method isCancelError

          isCancelError: (error: any) => boolean;

            method list

            list: (path: any, config?: any) => Promise<any>;
            • List bucket objects relative to the level and prefix specified

              Parameter path

              the path that contains objects

              Parameter config

              - Promise resolves to list of keys for all objects in path

            method put

            put: (key: string, object: any, config?: any) => Promise<Object>;
            • Put a file in storage bucket specified to configure method

              Parameter key

              key of the object

              Parameter object

              File to be put in bucket

              Parameter config

              - promise resolves to object on success

            method remove

            remove: (key: string, config?: any) => Promise<any>;
            • Remove the object for specified key

              Parameter key

              key of the object

              Parameter config

              - Promise resolves upon successful removal of the object

            method removePluggable

            removePluggable: (providerName: string) => void;
            • Remove the plugin object

              Parameter providerName

              the name of the plugin

            Interfaces

            interface S3CopyTarget

            interface S3CopyTarget {}

              property identityId

              identityId?: string;

                property key

                key: string;

                  property level

                  level?: StorageLevel;

                    interface S3ProviderCopyConfig

                    interface S3ProviderCopyConfig extends StorageOptions {}

                      property acl

                      acl?: CopyObjectRequest['ACL'];

                        property bucket

                        bucket?: CopyObjectRequest['Bucket'];

                          property cacheControl

                          cacheControl?: CopyObjectRequest['CacheControl'];

                            property cancelTokenSource

                            cancelTokenSource?: CancelTokenSource;

                              property contentDisposition

                              contentDisposition?: CopyObjectRequest['ContentDisposition'];

                                property contentLanguage

                                contentLanguage?: CopyObjectRequest['ContentLanguage'];

                                  property contentType

                                  contentType?: CopyObjectRequest['ContentType'];

                                    property expires

                                    expires?: CopyObjectRequest['Expires'];

                                      property metadata

                                      metadata?: CopyObjectRequest['Metadata'];

                                        property serverSideEncryption

                                        serverSideEncryption?: CopyObjectRequest['ServerSideEncryption'];

                                          property SSECustomerAlgorithm

                                          SSECustomerAlgorithm?: CopyObjectRequest['SSECustomerAlgorithm'];

                                            property SSECustomerKey

                                            SSECustomerKey?: CopyObjectRequest['SSECustomerKey'];

                                              property SSECustomerKeyMD5

                                              SSECustomerKeyMD5?: CopyObjectRequest['SSECustomerKeyMD5'];

                                                property SSEKMSKeyId

                                                SSEKMSKeyId?: CopyObjectRequest['SSEKMSKeyId'];

                                                  property tagging

                                                  tagging?: CopyObjectRequest['Tagging'];

                                                    interface S3ProviderGetConfig

                                                    interface S3ProviderGetConfig extends StorageOptions {}

                                                      property bucket

                                                      bucket?: GetObjectRequest['Bucket'];

                                                        property cacheControl

                                                        cacheControl?: GetObjectRequest['ResponseCacheControl'];

                                                          property cancelTokenSource

                                                          cancelTokenSource?: CancelTokenSource;

                                                            property contentDisposition

                                                            contentDisposition?: GetObjectRequest['ResponseContentDisposition'];

                                                              property contentEncoding

                                                              contentEncoding?: GetObjectRequest['ResponseContentEncoding'];

                                                                property contentLanguage

                                                                contentLanguage?: GetObjectRequest['ResponseContentLanguage'];

                                                                  property contentType

                                                                  contentType?: GetObjectRequest['ResponseContentType'];

                                                                    property download

                                                                    download?: boolean;

                                                                      property expires

                                                                      expires?: number;

                                                                        property progressCallback

                                                                        progressCallback?: (progress: any) => any;

                                                                          property provider

                                                                          provider?: string;

                                                                            property SSECustomerAlgorithm

                                                                            SSECustomerAlgorithm?: GetObjectRequest['SSECustomerAlgorithm'];

                                                                              property SSECustomerKey

                                                                              SSECustomerKey?: GetObjectRequest['SSECustomerKey'];

                                                                                property SSECustomerKeyMD5

                                                                                SSECustomerKeyMD5?: GetObjectRequest['SSECustomerKeyMD5'];

                                                                                  property track

                                                                                  track?: boolean;

                                                                                    interface S3ProviderListConfig

                                                                                    interface S3ProviderListConfig extends StorageOptions {}

                                                                                      property bucket

                                                                                      bucket?: string;

                                                                                        property maxKeys

                                                                                        maxKeys?: number;

                                                                                          interface S3ProviderListOutputItem

                                                                                          interface S3ProviderListOutputItem {}

                                                                                            property eTag

                                                                                            eTag: ListObjectsCommandOutputContent['ETag'];

                                                                                              property key

                                                                                              key: ListObjectsCommandOutputContent['Key'];

                                                                                                property lastModified

                                                                                                lastModified: ListObjectsCommandOutputContent['LastModified'];

                                                                                                  property size

                                                                                                  size: ListObjectsCommandOutputContent['Size'];

                                                                                                    interface S3ProviderPutConfig

                                                                                                    interface S3ProviderPutConfig extends StorageOptions {}

                                                                                                      property acl

                                                                                                      acl?: PutObjectRequest['ACL'];

                                                                                                        property bucket

                                                                                                        bucket?: PutObjectRequest['Bucket'];

                                                                                                          property cacheControl

                                                                                                          cacheControl?: PutObjectRequest['CacheControl'];

                                                                                                            property cancelTokenSource

                                                                                                            cancelTokenSource?: CancelTokenSource;

                                                                                                              property contentDisposition

                                                                                                              contentDisposition?: PutObjectRequest['ContentDisposition'];

                                                                                                                property contentEncoding

                                                                                                                contentEncoding?: PutObjectRequest['ContentEncoding'];

                                                                                                                  property contentType

                                                                                                                  contentType?: PutObjectRequest['ContentType'];

                                                                                                                    property expires

                                                                                                                    expires?: PutObjectRequest['Expires'];

                                                                                                                      property metadata

                                                                                                                      metadata?: PutObjectRequest['Metadata'];

                                                                                                                        property progressCallback

                                                                                                                        progressCallback?: (progress: any) => any;

                                                                                                                          property serverSideEncryption

                                                                                                                          serverSideEncryption?: PutObjectRequest['ServerSideEncryption'];

                                                                                                                            property SSECustomerAlgorithm

                                                                                                                            SSECustomerAlgorithm?: PutObjectRequest['SSECustomerAlgorithm'];

                                                                                                                              property SSECustomerKey

                                                                                                                              SSECustomerKey?: PutObjectRequest['SSECustomerKey'];

                                                                                                                                property SSECustomerKeyMD5

                                                                                                                                SSECustomerKeyMD5?: PutObjectRequest['SSECustomerKeyMD5'];

                                                                                                                                  property SSEKMSKeyId

                                                                                                                                  SSEKMSKeyId?: PutObjectRequest['SSEKMSKeyId'];

                                                                                                                                    property tagging

                                                                                                                                    tagging?: PutObjectRequest['Tagging'];

                                                                                                                                      property track

                                                                                                                                      track?: boolean;

                                                                                                                                        property useAccelerateEndpoint

                                                                                                                                        useAccelerateEndpoint?: boolean;

                                                                                                                                          interface S3ProviderPutOutput

                                                                                                                                          interface S3ProviderPutOutput {}

                                                                                                                                            property key

                                                                                                                                            key: string;

                                                                                                                                              interface S3ProviderRemoveConfig

                                                                                                                                              interface S3ProviderRemoveConfig extends StorageOptions {}

                                                                                                                                                property bucket

                                                                                                                                                bucket?: string;

                                                                                                                                                  interface StorageOptions

                                                                                                                                                  interface StorageOptions {}

                                                                                                                                                    property bucket

                                                                                                                                                    bucket?: string;

                                                                                                                                                      property credentials

                                                                                                                                                      credentials?: ICredentials;

                                                                                                                                                        property customPrefix

                                                                                                                                                        customPrefix?: CustomPrefix;
                                                                                                                                                        • Custom mapping of your prefixes. For example, customPrefix: { public: 'myPublicPrefix' } will make public level operations access 'myPublicPrefix/' instead of the default 'public/'.

                                                                                                                                                        property dangerouslyConnectToHttpEndpointForTesting

                                                                                                                                                        dangerouslyConnectToHttpEndpointForTesting?: boolean;

                                                                                                                                                          property level

                                                                                                                                                          level?: StorageLevel;

                                                                                                                                                            property region

                                                                                                                                                            region?: string;

                                                                                                                                                              property track

                                                                                                                                                              track?: boolean;
                                                                                                                                                              • if set to true, automatically sends Storage Events to Amazon Pinpoint

                                                                                                                                                              interface StorageProvider

                                                                                                                                                              interface StorageProvider {}

                                                                                                                                                                method cancel

                                                                                                                                                                cancel: (request: Promise<any>) => void;

                                                                                                                                                                  method configure

                                                                                                                                                                  configure: (config: object) => object;

                                                                                                                                                                    method copy

                                                                                                                                                                    copy: (
                                                                                                                                                                    src: StorageCopySource,
                                                                                                                                                                    dest: StorageCopyDestination,
                                                                                                                                                                    config?: any
                                                                                                                                                                    ) => Promise<any>;

                                                                                                                                                                      method get

                                                                                                                                                                      get: (key: string, options?: any) => Promise<string | Object>;

                                                                                                                                                                        method getCategory

                                                                                                                                                                        getCategory: () => string;

                                                                                                                                                                          method getProviderName

                                                                                                                                                                          getProviderName: () => string;

                                                                                                                                                                            method list

                                                                                                                                                                            list: (path: any, options?: any) => Promise<any>;

                                                                                                                                                                              method put

                                                                                                                                                                              put: (key: string, object: any, options?: any) => Promise<Object>;

                                                                                                                                                                                method remove

                                                                                                                                                                                remove: (key: string, options?: any) => Promise<any>;

                                                                                                                                                                                  Type Aliases

                                                                                                                                                                                  type CustomPrefix

                                                                                                                                                                                  type CustomPrefix = {
                                                                                                                                                                                  [key in StorageLevel]?: string;
                                                                                                                                                                                  };

                                                                                                                                                                                    type S3CopyDestination

                                                                                                                                                                                    type S3CopyDestination = Omit<S3CopyTarget, 'identityId'>;

                                                                                                                                                                                      type S3CopySource

                                                                                                                                                                                      type S3CopySource = S3CopyTarget;

                                                                                                                                                                                        type S3ProviderCopyOutput

                                                                                                                                                                                        type S3ProviderCopyOutput = {
                                                                                                                                                                                        key: string;
                                                                                                                                                                                        };

                                                                                                                                                                                          type S3ProviderGetOuput

                                                                                                                                                                                          type S3ProviderGetOuput<T> = T extends {
                                                                                                                                                                                          download: true;
                                                                                                                                                                                          }
                                                                                                                                                                                          ? GetObjectCommandOutput
                                                                                                                                                                                          : string;

                                                                                                                                                                                            type S3ProviderListOutput

                                                                                                                                                                                            type S3ProviderListOutput = S3ProviderListOutputItem[];

                                                                                                                                                                                              type S3ProviderRemoveOutput

                                                                                                                                                                                              type S3ProviderRemoveOutput = DeleteObjectCommandOutput;

                                                                                                                                                                                                type StorageCopyDestination

                                                                                                                                                                                                type StorageCopyDestination = Omit<StorageCopyTarget, 'identityId'>;

                                                                                                                                                                                                  type StorageCopySource

                                                                                                                                                                                                  type StorageCopySource = StorageCopyTarget;

                                                                                                                                                                                                    type StorageCopyTarget

                                                                                                                                                                                                    type StorageCopyTarget = {
                                                                                                                                                                                                    key: string;
                                                                                                                                                                                                    level?: string;
                                                                                                                                                                                                    identityId?: string;
                                                                                                                                                                                                    };

                                                                                                                                                                                                      type StorageLevel

                                                                                                                                                                                                      type StorageLevel = 'public' | 'protected' | 'private';

                                                                                                                                                                                                        Package Files (6)

                                                                                                                                                                                                        Dependencies (8)

                                                                                                                                                                                                        Dev Dependencies (1)

                                                                                                                                                                                                        Peer Dependencies (0)

                                                                                                                                                                                                        No peer dependencies.

                                                                                                                                                                                                        Badge

                                                                                                                                                                                                        To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                                                                                                                        You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@aws-amplify/storage.

                                                                                                                                                                                                        • Markdown
                                                                                                                                                                                                          [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@aws-amplify/storage)
                                                                                                                                                                                                        • HTML
                                                                                                                                                                                                          <a href="https://www.jsdocs.io/package/@aws-amplify/storage"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>