Giter VIP home page Giter VIP logo

dpd-s3's Introduction

dpd-s3

npm

Description

deployd module that generate AWS S3 signedUrl. You can HTTP PUT/GET/DELETE files via the signedUrl from s3 storage.

Getting started

This module requires deployd ~0.7.0.

If you haven't used Deployd before, make sure to read the documentation.

Installation without package.json

npm install dpd-s3

Installation with package.json

If you have a package.json, you'll have to add this module in it.

npm install dpd-s3 --save

Once it is installed, Deployd will automatically load it.
For more information about Modules, take a look at the module page on the deployd documentation.

The dpd-s3 module

Overview

It is a simple aws-sdk wrapper for deployd

Options/Settings

Require:

  • AWS Access Key
  • AWS Access Secret
  • S3 Region
  • S3 bucket

Please fill them in using the deployd dashboard config page of this module.

Usage example

Using dpd.js

Dpd-s3 request a Signed URL to allow uploading/downloading a file.

Request a Signed URL to upload a file named 'apple.jpg'

dpd.s3bucket.get('apple.jpg', {
    signedUrl: 'Put'
    ContentType: 'image/jpeg'
}, function(signedUrl, err){

    // regular http put file to signedUrl
    $.ajax({type:'Put', url:signedUrl}, ...);

})

Request a Signed URL to download a file named 'apple.jpg'

<img src="/s3bucket/apple.jpg" />

OR

dpd.s3bucket.get('apple.jpg', {
    returnFormat: 'Url'
}, function(signedUrl, err){
    console.log(signedUrl);
})

Delete file names 'apple.jpg'

dpd.s3bucket.delete('apple.jpg', function(ret, err){
    console.log(ret, err);
})

Using HTTP Requests

Request a Signed URL to upload a file named 'apple.jpg'. Then do a PUT request to the returned URL with your file in parameter, dont forget to set the proper header 'Content-Type' for this request too.

GET http://localhost:2403/my-bucket/apple.jpg?ContentType=image/jpeg&signedUrl=Put

Request a Signed URL to download a file named 'apple.jpg'

GET http://localhost:2403/my-bucket/apple.jpg?returnFormat=Url

Delete file names 'apple.jpg'

DELETE http://localhost:2403/my-bucket/apple.jpg

Contributing

Just send me a Pull Request in Github.

Release history

  • 0.1.0: refactor to use aws-sdk and signedUrl instead of direct upload

Contributors

Eric Fong cowgp dallonf

dpd-s3's People

Contributors

ericfong avatar cowgp avatar wes-nz avatar dallonf avatar nicolasritouet avatar ritch avatar

Watchers

ScriptMaster avatar James Cloos avatar  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.