Skip to content
Fetch an asset (picture for instance) from a remote URL and upload it to Amazon S3
JavaScript
Latest commit 6bd64b0 Jul 16, 2015 @saintmac bumping version
Failed to load latest commit information.
lib adding region config Jul 16, 2015
test download method Jul 16, 2015
.gitignore bucket api Oct 24, 2013
LICENSE Initial commit Oct 22, 2013
README.md Update README : more informations Dec 29, 2014
index.js initial commit Oct 22, 2013
package.json bumping version Jul 16, 2015

README.md

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

credentials

create an aws_config.json file with the following fields. You can put whatever region you like.

{
  "accessKeyId": "YOUR AWS ACCESS KEY",
  "secretAccessKey": "SECRET OF YOUR AWS ACCESS KEY",
  "region": "eu-west-1"
}

You can use different bucket name depending on your environment.

use

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

var fus3 = new FUS3('my_aws_bucket');

// 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

Something went wrong with that request. Please try again.