Giter Club home page Giter Club logo

belt_copy's Introduction

Belt

Hex.pm Hexdocs.pm License Build Status

Extensible Elixir OTP Application for storing files remotely or locally through a unified API. Backends currently exist for the local filesystem, SFTP and the Amazon S3 API.

Documentation

Check out the documentation at hexdocs.pm/belt and our Getting Started guide.

Usage

#Simple file upload
{:ok, config} = Belt.Provider.SFTP.new(host: "example.com", directory: "/var/files",
                                       user: "…", password: "…")
Belt.store(config, "/path/to/local/file.ext")
#=> {:ok, %Belt.FileInfo{…}}


#Asynchronous file upload
{:ok, config} = Belt.Provider.S3.new(access_key_id: "…", secret_access_key: "…",
                                     bucket: "belt-file-bucket")
{:ok, job} = Belt.store_async(config, "/path/to/local/file.ext")
#Do other things while Belt is uploading in the background
Belt.await(job)
#=> {:ok, %Belt.FileInfo{…}}

Installation

Belt can be installed by adding belt to your dependencies and application list in mix.exs:

def deps do
  [{:belt, "~> 0.1.0"}]
end

def application do
  [extra_applications: [:belt]]
end

Installation for the S3 backend

If you want to use the S3 backend, you also need to add ExAws with ExAws S3 as well as Hackney and sweet_xml (which are required by ExAws) to your dependencies and applications list:

def deps do
  [{:belt, "~> 0.4.0"},
   {:ex_aws, "~> 2.1"},
   {:ex_aws_s3, "~> 2.0"},
   {:hackney, "~> 1.9"},
   {:sweet_xml, "~> 0.6"}]
end

def application do
  [extra_applications: [:belt, :hackney, .sweet_xml]]
end

License

Belt is dual-licensed and can be used under the terms of either the GNU AGPLv3 or the Apache 2.0 license (which is the license Elixir uses).

belt_copy's People

Contributors

wmnnd avatar jayjun avatar harper avatar

Watchers

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