Skip to content

gcornut/clj-ipfs-api

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IPFS API wrapper in Clojure

A simple wrapper for interacting with IPFS API

Get it

;In deps.edn
{:deps {gcornut/clj-ipfs-api {:git/url "git@github.com:gcornut/clj-ipfs-api.git"
                              :sha "<LATEST MASTER BRANCH COMMIT SHA>"}}


;; In your ns statement:
(require '[clj-ipfs-api.core :as ipfs])
(ipfs/setup!)

Usage

Launch the IPFS Daemon.

;; for default daemon settings use just like cli
;; commands are joined with dashes
(ipfs/swarm-peers)
;; arguments are strings
(ipfs/cat
  "QmShWPeTZL5px2YGvgJD99C4SuHEqry1u1RoNu1bAVDkM1"
  "QmbRdyLXiFWrKc5hW1NbvpUxF9tLovWCPgiz4BDhjD9k3j")
;; flags go in a map
(ipfs/swarm-peers {:type "indirect"}) 

Custom API server address has to be set up.

(ipfs/set-api-url! "http://127.0.0.1:55555")

Everything is decoded from json, except cat. To change request options use a map under :request key.

;; different API server
(ipfs/swarm-peers {:request {:url "http://127.0.0.1:55555"}})

;; for big files use a stream, no json parsing is done in this case
(ipfs/swarm-peers {:request {:as :stream}})

For more options that are taken by the :request map, look at the second argument of request function in clj-http.

License

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

2016 keorn

About

Simple Clojure wrapper for IPFS API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Clojure 100.0%