@novo-x/aws-s3
v1.1.7
Published
AWS S3 file upload core
Downloads
721
Readme
AWS S3 Service
Available methods
- upload: uploads a file to the bucket
- getPresignedUrlForFile: retrieves a presigned url for a file
- download: downloads a file from the bucket
- delete: deletes a file from the bucket
- updateAwsConfig: updates the aws config
Usage examples
yarn add @novo-x/aws-s3
import {S3} from "@novo-x/aws-s3"
const MyService = new S3(
'mybucket', // bucket
{}, // optional s3 instance config
);
const upload = await MyService.upload(
'folder_name/123456789', // objectKey
'8172638123', // fileStream
'public-read', // ACL
'image/png' // contentType
)
MyService.updateAwsConfig({
// ... AWS config
})
const presignedUrl = await MyService.getPresignedUrlForFile(
'folder_name/123456789' // objectKey
)
const image = await MyService.download(
'folder_name/123456789' // objectKey
)
const response = await MyService.delete(
'folder_name/123456789' // objectKey
)