JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 8
  • Score
    100M100P100Q63442F
  • License ISC

Upload an image from url to s3 as base64

Package Exports

  • s3-imgurl-upload

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 (s3-imgurl-upload) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

S3 Upload Image from Url

Upload an image from a URL to s3 (AWS cloud storage)

Parameters:

    s3ImgUrl.upload(AWSaccessKeyId, AWSsecretAccessKey, s3Bucket, imgUrl, s3endpoint, s3imgKey, width, height)
    .then(s3_image_url => {
        // returns public url to image in s3 bucket (e.g, https://s3Bucket.s3.amazonaws.com/s3imgKey)
    });

(1) Upload image from url resized

    var s3ImgUrl = require('s3-imgurl-upload');
    s3ImgUrl.upload(awsKeyId, awsAccessKey, s3Bucket, 'https://some.website/image.png', `https://${s3Bucket}.s3.amazonaws.com`, 'path/fileName.jpg', 200, 260)
    .then(s3_image_url => {
        console.log(s3_image_url);
        // https://${s3Bucket}.s3.amazonaws.com/path/fileName.jpg
    });

(2) Upload image from url without resizing (set width and height to 0)

    var s3ImgUrl = require('s3-imgurl-upload');
    s3ImgUrl.upload(awsKeyId, awsAccessKey, s3Bucket, 'https://some.website/image.png', `https://${s3Bucket}.s3.amazonaws.com`, 'fileName.jpg', s3Bucket, 0, 0)
    .then(s3_image_url => {
        console.log(s3_image_url);
        // https://${s3Bucket}.s3.amazonaws.com/fileName.jpg
    });