Git Product home page Git Product logo

s3-streams's Introduction

S3-Streams

An Amazon S3 client in Haskell, based on Http-Streams

This is an implementation of the AWS S3 API using http-streams, an HTTP client written using io-streams, a relatively lightweight and simple Haskell IO manager with strict guarantees. The existing aws package is large and full-featured, but it relies on Conduits, bringing in a large dependency as well as cognitive overhead for those who don't want to learn a rather complex API. There is also the hS3 package, which is much simpler but uses vanilla IO and doesn't provide guarantees of constant space. The goal of this is to provide a middle-ground: a lean and lightweight, but usable and powerful S3 client.

Example:

First, load your AWS access key id and secret access key into your environment under the keys AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY, respectively. Then, assuming you have the bucket my_bucket with object my_object, this code will print the contents of my_object to stdout:

import qualified Network.AWS.S3 as S3
import Network.Http.Client (debugHandler)
import System.IO.Streams as Streams

main = do
  -- Build a connection with default options
  con <- S3.defaultConnection
  cmd <- S3.get "my_bucket" "my_object" con
  -- Prints the contents of `my_object` to stdout.
  S3.performRequest debugHandler cmd

We can also write to an S3 bucket; for example:

main = do
  con <- S3.defaultConnection
  cmd <- S3.buildCommand' con $ do
    setMethod PUT
    setBucket "my_bucket"
    setObject "my_object"
    setBody "Hello, world!"
  S3.performRequest echoHandler cmd

Status:

Just recently passed the milestone of making a successful GET request. Still quite a ways to go but (it seems) the worst is passed.

License:

MIT

s3-streams's People

Stargazers

David Johnson avatar

Watchers

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