Giter Site home page Giter Site logo

elixir_skynet's Introduction

ElixirSkynet

Unofficial Elixir client for uploading and downloading files from Sia Skynet.

Installation

The package can be installed by adding skynet to your list of dependencies in mix.exs:

def deps do
  [
    {:skynet, "~> 0.1.6"}
  ]
end

Usage

# Download a file using its Skylink
iex> Skynet.download("AADOl5bb0oXpmIWOK115bctmbV9Jogl-FcyMmIzb5MV1ZA")
{:ok,
  %{
    file: <<79, 103, 103, 83, 0, 2, 0, 0, 0, ...>>,
    filename: "Bach_Fugue_in_A-minor_BMW_543.opus"
  }
}

# Upload a file by providing its path
iex> Skynet.upload("path/to/file.jpeg")
{:ok,
  %{
    skylink: "AACEIgsvJKk7yY2y9Z-dXTh5niUAKwO_jH4LpbLiaw5X1g",
    # In addition to the Skylink, the merkleroot and bitfield are also returned for convenience
    merkleroot: "84220b2f24a93bc98db2f59f9d5d38799e25002b03bf8c7e0ba5b2e26b0e57d6",
    bitfield: 0
  }
}

# Configure options, like the target portal URL
iex> Skynet.upload("path/to/file.jpeg", portal_url: "https://skydrain.com")
{:ok,
  %{
    skylink: "AACEIgsvJKk7yY2y9Z-dXTh5niUAKwO_jH4LpbLiaw5X1g",
    merkleroot: "84220b2f24a93bc98db2f59f9d5d38799e25002b03bf8c7e0ba5b2e26b0e57d6",
    bitfield: 0
  }
}

The documentation can be found at https://hexdocs.pm/skynet.

Remarks

Built with Sia

elixir_skynet's People

Contributors

alexfreska avatar

Stargazers

 avatar  avatar  avatar

Watchers

 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.