skipper-s3-resize

Streaming file uploads to S3 and resize images

Usage no npm install needed!

<script type="module">
  import skipperS3Resize from 'https://cdn.skypack.dev/skipper-s3-resize';
</script>

README

skipper-s3-resize

Based on SailsJS Skipper S3 adapter for receiving upstreams with a twist: Images will be resized before uploading using GraphicMagick.

Installation

First of all, make sure you have graphicmagick installed.

To install it using npm:

$ npm install skipper-s3-resize --save

Also make sure you have skipper itself installed as your body parser. This is the default configuration in Sails as of v0.10.

Usage

  1. In Controller:
  upload: function(req, res) {
    req.file('image').upload({
      adapter: require('skipper-s3-resize'),
      key: <YOUR_S3_KEY>,
      secret: <YOUR_S3_SECRET>,
      bucket: <YOUR_S3_BUCKET>,
      resize: {
        width: <WIDTH>,
        height: <HEIGHT>,
        options: <GRAPHICMAGICK_OPTIONS>
      }
    }, function(err, uploadedFiles) {
      if(err) return res.serverError(err);
        res.ok();
      });
    }

Options

  1. Refer skipper documentations.