0.3.2 • Published 5 years ago

fetch-upload-s3 v0.3.2

Weekly downloads
69
License
MIT
Repository
github
Last release
5 years ago

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 app environment variables and set

AWS_ACCESS_KEY_ID

AWS_SECRET_ACCESS_KEY

AWS_REGION

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

0.3.2

5 years ago

0.3.0

10 years ago

0.2.2

11 years ago

0.2.1

11 years ago

0.2.0

12 years ago

0.1.0

12 years ago