npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

skipper-s3-gm

v1.0.1

Published

Streaming file uploads to S3 and GraphicsMagick

Downloads

1

Readme

[][project-root] Skipper-S3-GM

skipper-s3-gm

Based on SailsJS Skipper S3 adapter for receiving upstreams and orginally forked from skipper-s3-resize but with MANY EXTRA features.

  • Added GraphicsMagick CROP, RESIZE, noProfile(Remove EXIF data) option
  • Added file rename option before it is uploaded to S3
  • S3 upload addition information (region, endpoint, token, maxBytes, headers)
  • Updated all depeneded packages to the latest version

Requirements

Getting started

First download and install GraphicsMagick or ImageMagick. In Mac OS X, you can simply use Homebrew and do:

Debian/Ubuntu

apt-get install graphicsmagick

MacOS X

brew install graphicsmagick

Installation

First of all, make sure you have graphicmagick installed.

To install it using npm:

$ npm install skipper-s3-gm --save

Also make sure you have skipper itself installed as your body parser.

Usage

  1. In Controller:
  upload: function(req, res) {
    req.file('image').upload({
      adapter: require('skipper-s3-gm'),
      key: <YOUR_S3_KEY>,
      secret: <YOUR_S3_SECRET>,
      bucket: <YOUR_S3_BUCKET>,
      region: <YOUR_S3_REGION_OPTIONAL>,
      endpoint: <YOUR_S3_ENDPOINT_OPTIONAL>,
      token: <YOUR_S3_TOKEN_OPTIONAL>,
      maxBytes: 1000 * 1000 * 10,   // [OPTIONAL]: S3 max upload size
      headers: {                    // [OPTIONAL]: S3 Additional Headers information
        'customkey': 'data'         
      },
      filename: function(file) {  // [OPTIONAL]: input can be wither FUNCTION or STRING
           return file.filename + '_awesome';
        },
      gm: {                         // [OPTIONAL]: You can skip all graphicsmagick options
        format: 'jpg',              // [OPTIONAL]: if you need to change the image format 
        noProfile: true,            // [OPTIONAL]: remove EXIF profile data (Default = false)
        crop: {                     // [OPTIONAL] Crop
          width: 200,
          height: 200,
          x: 0,
          y: 0
        },
         resize: {                  // [OPTIONAL] Resize
          width: 200,
          height: 200,
          options: '!'              // DOC: http://aheckmann.github.io/gm/docs.html#resize
        }
      }
    }, function(err, body) {

      // If successful, will return body, containing Location, Bucket, Key, ETag and size of the object.
      // Otherwise it will return an error.
      /*
        {
            Location: 'http://Example-Bucket.s3.amazonaws.com/destination.txt',
            Bucket: 'Example-Bucket',
            Key: 'destination.txt',
            ETag: '"3858f62230ac3c915f300c664312c11f-9"',
            size: 7242880
        }
      */
      if(err) {
        return res.serverError(err);
      }
      res.ok();
    });
  }

Options

  1. Refer skipper documentations.