Wrapper for AWS S3 blob storage
npm install @babl.one/storage-amazon-s3
@aws-sdk/client-s3 package.
bash
npm install @aws-sdk/client-s3
`
Configuration
In order to use the plugin, provide your AWS credentials and configuration details in the config object.
The plugin expects the following configuration fields:
- region: The AWS region of the S3 bucket
- apiKey: Your AWS access key ID
- privateKey: Your AWS secret access key
Example configuration:
`ts
const config = {
region: 'us-west-2',
apiKey: 'YOUR_API_KEY',
privateKey: 'YOUR_PRIVATE_KEY',
};
`
Methods
$3
Initializes the S3Client using the provided AWS credentials and region.
$3
Downloads a file from an S3 bucket to the local file system. The file will be written to the path specified in file.localPath.
$3
Uploads a file to an S3 bucket. The file data is taken from file.blob, and it is stored at file.remotePath.
$3
Deletes a file from an S3 bucket using the file.remotePath.
$3
Renames a file in an S3 bucket by copying it to a new key (file.remotePathNew`) and then deleting the original.