S3 zip handler
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
We highly recommend aws-sdk-v3 usage
import s3ZipHandler from 's3-zip-handler'
import { S3Client } from '@aws-sdk/client-s3'
const s3Client = new S3Client({
...your s3 settings
})
- 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'