Coder Social home page Coder Social logo

stradap / fetch-upload-s3 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from saintmac/fetch-upload-s3

0.0 1.0 0.0 191 KB

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

License: MIT License

JavaScript 100.00%

fetch-upload-s3's Introduction

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

fetch-upload-s3's People

Contributors

saintmac avatar mabdylon avatar gogson avatar hpogosyan avatar

Watchers

Pablo Estrada avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.