New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

s3-stream-zipper

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

s3-stream-zipper

Downloading files from S3 bucket and their archivation. Using Stream, so the package doesn't spend RAM and disk space

  • 1.1.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7
Maintainers
1
Weekly downloads
 
Created
Source

S3 stream zipper

npm version GitHub code size in bytes

Allows to download and archive large amounts of data from AWS S3. Unlike similar solutions, it does not save downloaded files entirely in RAM and on disk. Files are downloaded in a stream in parts and immediately archived.

.archive(files) returns Stream

Installation

npm i s3-stream-zipper

Usage

  const files = [
    'video.mp4',
    'fileName.mkv',
    'folder/3.jpeg',
    { key: '6.jpeg' },
    { key: 'folder/6.jpeg' },
    { key: 'folder/6.jpeg' name: 'img6.jpeg' },
    { key: 'folder/7.jpeg' name: 'img7.jpeg', folder: 'images' },
  ];

  const s3zipper = new S3zipper({
   accessKeyId: 'ACCESS_KEY',
   secretAccessKey: 'SECRE_ACCESS_KEY',
   region: 'eu-central-1',
   bucket: 'bucket-test',
  });

  const zipperStream = s3zipper.archive(files);
Stream to file
  const s3zipper = new S3zipper({
    accessKeyId: 'ACCESS_KEY',
    secretAccessKey: 'SECRE_ACCESS_KEY',
    region: 'eu-central-1',
    bucket: 'bucket-test',
  });

  const output = await fs.createWriteStream(join(__dirname, `use-${Date.now()}.zip`));

  s3zipper
    .archive(files)
    .pipe(output);
usage s3 in config
  AWS.config.update({
    accessKeyId: 'ACCESS_KEY',
    secretAccessKey: 'SECRE_ACCESS_KEY',
    region: 'eu-central-1',
  });

  const s3 = new AWS.S3();
  const s3zipper = new S3zipper({
    s3,
    bucket: 'bucket-test',
    debug: true
  });

  const zipperStream = s3zipper.archive(files);
Stream to s3
  AWS.config.update({
    accessKeyId: 'ACCESS_KEY',
     secretAccessKey: 'SECRE_ACCESS_KEY',
     region: 'eu-central-1',
  });

  const s3 = new AWS.S3();
  const s3zipper = new S3zipper({
    s3,
    bucket: 'bucket-test',
    debug: true
  });

  const zipperStream = s3zipper.archive(files);

  const params = { Bucket: 'bucket-test', Key: `archives/${Date.now()}.zip`, Body: zipperStream };
  s3.upload(params)
    .on('httpUploadProgress', function (evt) { console.log(evt) })
    .send(function (e, r) {
      if (e) {
        const err = 'zipFile.upload error ' + e;
        console.log(err)
      }
      console.log(r)
    });

Keywords

FAQs

Package last updated on 05 Mar 2021

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc