1.0.3 • Published 7 years ago
s3zip v1.0.3
S3Zip
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, accessKeyId, secretAccessKey})
Arguments
- keys (string): an array of S3 keys
- bucket (string) : an S3 bucket
- outputFile (string) : the destination key for the zip file on S3
- accessKeyId (string) : AWS Access Key Id
- secretAccessKey (string) : AWS Secret Access Key
Returns
- (Promise): Returns a promise of the S3 upload operation
Example
const {zipFiles} = require('s3zip')
zipFiles({
keys: ['file1.txt', 'file2.txt']),
bucket: 'some-bucket',
outputFile: 'files.zip',
accessKeyId: 'ACCESSKEY',
secretAccessKey: 'SECRETACCESSKEY'
})
.then(console.log)
/*
{
ETag: '"52344a8de6c541c261b9d2e3bda6fda2"',
Location: 'https://some-bucket.s3.amazonaws.com/files.zip',
key: 'files.zip',
Key: 'files.zip',
Bucket: 'some-bucket'
}
*/