An AssetStorageStrategy which uses Amazon S3 object storage service. To us this strategy you must first have access to an AWS account. See their getting started guide for how to get set up.
Before using this strategy, make sure you have the @aws-sdk/client-s3 and @aws-sdk/lib-storage package installed:
Note: Rather than instantiating this manually, use the configureS3AssetStorage function.
This strategy will also work with any S3-compatible object storage solutions, such as MinIO. See the configureS3AssetStorage for an example with MinIO.
AssetStorageStrategy() => (() => void | Promise<void>) | undefined(fileName: string, data: Buffer) => (fileName: string, data: Readable) => (identifier: string) => (identifier: string) => (identifier: string) => (fileName: string) => Configuration for connecting to AWS S3.
AwsCredentialIdentity | AwsCredentialIdentityProviderThe credentials used to access your s3 account. You can supply either the access key ID & secret, or you can make use of a
shared credentials file
To use a shared credentials file, import the fromIni() function from the "@aws-sdk/credential-provider-ini" or "@aws-sdk/credential-providers" package and supply
the profile name (e.g. { profile: 'default' }) as its argument.
stringThe S3 bucket in which to store the assets. If it does not exist, it will be created on startup.
anyConfiguration object passed directly to the AWS SDK.
S3.Types.ClientConfiguration can be used after importing aws-sdk.
Using type any in order to avoid the need to include aws-sdk dependency in general.
anyConfiguration object passed directly to the AWS SDK.
ManagedUpload.ManagedUploadOptions can be used after importing aws-sdk.
Using type any in order to avoid the need to include aws-sdk dependency in general.
Returns a configured instance of the S3AssetStorageStrategy which can then be passed to the AssetServerOptionsstorageStrategyFactory property.
Before using this strategy, make sure you have the @aws-sdk/client-s3 and @aws-sdk/lib-storage package installed:
Example
Reference: How to use AWS SDK for Javascript with MinIO Server
Example
Parameters
S3Config