Skip to content

Instantly share code, notes, and snippets.

View charsville's full-sized avatar

Reece Charsville charsville

View GitHub Profile
charsville / Upload.ts
Created November 24, 2022 15:17
AWS S3 upload function
View Upload.ts
import { PutObjectOutput, PutObjectRequest } from 'aws-sdk/clients/s3';
import {AWSError} from 'aws-sdk/lib/error';
import * as S3 from 'aws-sdk/clients/s3';
import Connect from './connection';
* Uploads a file to your bucket in either the root or a subdirectory
* In this example we are making all objects publicly accessible by using the ACL 'public-read'. If you want to make
* the file private or use a different access policy then you can read more about canned ACLs here: