Socket
Socket
Sign inDemoInstall

s3-zip-archiver

Package Overview
Dependencies
185
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    s3-zip-archiver

Read and upload a zip archive of s3 files to s3 using streams


Version published
Weekly downloads
0
Maintainers
1
Created
Weekly downloads
 

Readme

Source

npm CodeQL ESLint

s3-zip-archiver

Upload to s3 a zip archive of s3 files using node streams.

  • Open streams of the s3 files using @aws-sdk/client-s3
  • Pipe the file stream into a zip archive using https://www.npmjs.com/package/archiver
  • Pipe the zip archive to s3 using @aws-sdk/lib-storage

Example

import { S3Client } from '@aws-sdk/client-s3';
import { zipper } from 's3-zip-archiver';

await zipper({
  s3Client: new S3Client({
    region: 'bucket-region',
  }),
  sourceFiles: [
    {
      key: 'path/file1.ext',
      name: 'filename1.ext',
      bucket: 'bucket-name',
    },
    {
      key: 'path/file2.ext',
      name: 'filename2.ext',
      bucket: 'bucket-name',
    },
  ],
  destinationBucket: 'bucket-name',
  destinationKey: `path/archive.zip`,
  onError: async (err) => {
    console.log('onError', err);
  },
  onFileMissing: async (key) => {
    console.log('onFileMissing', key);
  },
  onFileDownloaded: async (key, completed) => {
    console.log('onFileDownloaded', key);
    console.log('completed', completed, 'downloads');
  },
  onHttpUploadProgress: async (progress) => {
    console.log('onProgress', progress);
  },
  onComplete: async (result) => {
    console.log('onComplete', result);
  },
  maxConcurrentDownloads = 25,
  minConcurrentDownloads = 4,
  streamArchiverOptions = {},
});

Keywords

FAQs

Last updated on 02 Mar 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc