Skip to content

Lightweight library that creates a zip file from files in a S3 bucket and stores the zip file in the same S3 bucket

License

Notifications You must be signed in to change notification settings

DivyaKhanani/s3zip

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

S3Zip

npm version CircleCI

S3Zip is a lightweight library that creates a zip file from files in a S3 bucket and stores the zip file in the same S3 bucket.

Install

$ npm install s3zip

Usage

zipFiles({keys, bucket, outputFile, s3})

Arguments

  • keys ([string]): an array of S3 keys
  • bucket (string) : an S3 bucket
  • outputFile (string) : the destination key for the zip file on S3
  • s3 (object) : AWS S3 instance

Returns

  • (Promise): Returns a promise of the S3 upload operation

Example

const AWS = require('aws-sdk')
const {zipFiles} = require('s3zip')

zipFiles({
  keys: ['file1.txt', 'file2.txt']),
  bucket: 'some-bucket',
  outputFile: 'files.zip',
  s3: new AWS.S3({accessKeyId, secretAccessKey})
})
.then(console.log)
/*
{
  ETag: '"52344a8de6c541c261b9d2e3bda6fda2"',
  Location: 'https://some-bucket.s3.amazonaws.com/files.zip',
  key: 'files.zip',
  Key: 'files.zip',
  Bucket: 'some-bucket'
}
*/

About

Lightweight library that creates a zip file from files in a S3 bucket and stores the zip file in the same S3 bucket

Resources

License

Stars

Watchers

Forks

Packages

No packages published