Giter VIP home page Giter VIP logo

s3-crewser's Introduction

s3-crewser

AWS s3 upload, list and delete recipe for clojure web apps.

Small server-side wrapper for amazonica and s3-beam for uploading, listing and deleting files from your clojure(script) web app. The main reason to use both s3-beam and amazonica in the same implementation is to leverage s3-beam to perform direct from browser uploading of files to s3 (therefore saving any server-side handling of those files) and to leverage amazonica for everything else (and again, not have to do any server-side handling of the actual files).

Note: This is a bare bones recipe and the amazonica library has much more functionality than what's demonstrated here.

Requires:

Server-side config

Wherever you define your routes, add a path for "/sign" like so:

(defroutes

  ;; aws s3-beam
   (GET "/sign" {params :params} (aws-s3/s3-sign))
  ;; end aws s3-beam

)

Server-side usage

List objects like so:

(ns server.some.namespace
  (:require
   [server.controllers.aws.s3 :as aws-s3]))
   
(aws-s3/list-objects)

Delete an object like so:

(ns server.some.namespace
  (:require
   [server.controllers.aws.s3 :as aws-s3]))
   
(aws-s3/delete-object-by-url! url)
;; OR
(aws-s3/delete-object-by-key! key)

Client-side usage

Upload an object like so (where uploaded is a core.async channel):

(ns client.some.namespace
  (:require 
    [s3-beam.client :as s3]))
    
(s3/s3-pipe uploaded)
    

For more info on how to use channels with s3-beam, see the s3-beam documentation: https://github.com/martinklepsch/s3-beam#3-integrate-the-upload-pipeline-into-your-frontend

Obscure name

s3-crewser is a silly name made from s3 CReate dElete for broWSER

s3-crewser's People

Contributors

benhowell avatar

Stargazers

 avatar

Watchers

 avatar  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.