@zvs001/s3-utils
v1.0.0
Published
Library provides additional useful methods, that doesn't exists in aws-sdk
Downloads
430
Readme
Library provides additional useful methods, that doesn't exists in aws-sdk
Getting Started
yarn: yarn add @zvs001/s3-utils
npm: npm i -S @zvs001/s3-utils
Note: in case you want to work with aws-sdk v2, you should use v0.1.0
import s3Utils from '@zvs001/s3-utils'
import { S3Client } from '@aws-sdk/client-s3'
const s3Client = new S3Client()
s3Utils.deleteDir(s3Client, { ... })
API
s3DeleteDir
Delete bucket directory with all containing files inside.
import s3Utils from '@zvs001/s3-utils'
// import { s3DeleteDir } from '@zvs001/s3-utils' // named import
await s3Utils.deleteDir(s3Client, {
Bucket: 'my-bucket',
Prefix: `folder/`,
})
s3SyncDir
Upload local directory to s3 bucket. It will upload recursively all files and directories.
import s3Utils from '@zvs001/s3-utils'
// import { s3SyncDir } from '@zvs001/s3-utils' // named import
const localDir = '/tmp/folder/'
await s3Utils.syncDir(s3Client, localDir, { bucket: 'bucket', bucketPath: 'sub-dir/' })