s3-zip-handler
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

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'
 

Package Sidebar

Install

npm i s3-zip-handler

Weekly Downloads

155

Version

2.0.0

License

ISC

Unpacked Size

28.2 kB

Total Files

17

Last publish

Collaborators

  • tindin