Skip to content

Fetch an asset (picture for instance) from a remote URL and upload it to Amazon S3

License

Notifications You must be signed in to change notification settings

JupitrrLtd/fetch-upload-s3

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fetch-upload-s3

Fetches an asset (picture for instance) from a remote URL (or a local file) and uploads it to Amazon S3.

install

npm install fetch-upload-s3

setup

use

var FUS3 = require("fetch-upload-s3");

var fus3 = new FUS3({
  s3_bucket_name,
  AWS_ACCESS_KEY_ID,
  AWS_SECRET_ACCESS_KEY,
  AWS_REGION,
});

// For fetch url :
fus3.init(function () {
  fus3.do("http://nodejs.org/images/logo.png", "my_key", function (err, data) {
    console.log("file uploaded to S3!");
    console.log(data);
  });
});

// for upload File :
fus3.init(function () {
  fus3.uploadFile(absoluteFilePath, "my_key", function (err, data) {
    console.log("file uploaded to S3!");
    console.log(data);
  });
});

A temp folder './.tmp/fetch_upload_s3' is used as a proxy. Temporary and source files are deleted locally as soon as they have been uploaded to S3

About

Fetch an asset (picture for instance) from a remote URL and upload it to Amazon S3

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%