1.0.4 • Published 6 years ago
s3-image-resize v1.0.4
S3-Image-Resize
A simple tool that allows you to do inplace image resizing for S3 files.
Usage
const s3Resizer = require('s3-image-resize');
s3Resizer(<WIDTH>, <HEIGHT>, <S3URL>, <BUCKET>, <KEY>, <ACL>, <ACCESS-KEY>, <SECRET-KEY>);
Example code resizing foo.jpg to 800x600 in a directory called images that resides in a bucket called assets and makes it publicly available for reading. Then prints done.
const s3Resizer = require('s3-image-resize');
s3Resizer(
800,
600,
'https://s3-eu-west-1.amazonaws.com/assets/images/foo.jpg',
'images',
'assets/foo.jpg',
'public-read',
'My-access-key-id',
'My-secret-key'
)
.then(() => {
console.log('done');
});
Dependencies
Sharp for resizing, Request for image downloading and AWS-SDK for AWS interactions.