JSPM

lbmesh-s3-upload-resize

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q61454F
  • License MIT

Updated Version of older s3_upload_resize for LBMesh Framework

Package Exports

  • lbmesh-s3-upload-resize

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (lbmesh-s3-upload-resize) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

lbmesh-s3-upload-resize

A simple way to upload files to s3 and, optionally, resize them. Uses s3.upload().

Installation

$ npm install --save lbmesh-s3-upload-resize

Usage

Upload

var s3UploadResize = require('lbmesh-s3-upload-resize');
var rName = 'test/resize_test.jpg';
s3UploadResize.uploadToS3('test.jpg', 'close5-legacy-staging', rName, '256x256', function(err, s3Url) {
    if (err) {
        console.log(err);
        return;
    }
    console.log('Uploaded to:',s3Url);
});

Initialization (optional)

You can pass a different logger or extraOptions (See: http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#createMultipartUpload-property )

var s3UploadResize = require('s3_upload_resize');
var debug = require('debug')('mymodule');

s3UploadResize.init({
  logger : debug,
   extraOptions : {CacheControl : 'public, max-age=31557600'} 
});

var rName = 'test/resize_test2.jpg';
s3UploadResize.uploadToS3('test.jpg', 'close5-legacy-staging', rName, '256x256', function(err, s3Url) {
    if (err) {
        console.log(err);
        return;
    }
    console.log('Uploaded to:',s3Url);
});
  

NOTES

You must have the AWS_ACCESS_KEY_ID and the AWS_SECRET_ACCESS_KEY in the environment to complete the upload to s3.

License

The MIT License (MIT)