s3-zip-handler
v2.0.0
Published
extract a zip file provided from your AWS s3 bucket to any other place
Downloads
823
Maintainers
Readme
S3 zip handler
S3 zip handler
What it does:
extract a zip file provided from your AWS s3 bucket to any other place, either local or back to s3 bucket where will create a new folder with the name of the .zip file
Basic usage:
We highly recommend aws-sdk-v3 usage
Start by declaring your S3 client:
import s3ZipHandler from 's3-zip-handler'
import { S3Client } from '@aws-sdk/client-s3'
const s3Client = new S3Client({
...your s3 settings
})
After declaring your S3 Client use the following code to:
- Decompress back to the s3 folder:
const s3Config = {
s3Client,
bucket: 'your-s3-bucket',
key: 'your-s3-key/your-zip-file.zip'
}
const {localPath, uploadedPath } = await s3ZipHandler.decompressToKeyFolderS3(s3Config)
// localPath = 'os-tmp/unzipped-xxxx/your-zip-file'
// uploadedPath = 'your-s3-bucket/your-s3-key/your-zip-file'
- Decompress to local folder:
const s3Config = {
s3Client,
bucket: 'your-s3-bucket',
key: 'your-s3-key/your-zip-file.zip'
}
const { localPath } = await s3ZipHandler.decompressLocal(s3Config, 'path-to-extract')
// localPath = 'path-to-extract/your-zip-file'