Skip to content

Latest commit

 

History

History
29 lines (24 loc) · 1.17 KB

README.md

File metadata and controls

29 lines (24 loc) · 1.17 KB

Cljs IPFS-API

ClojureScript wrapper for JavaScript HTTPL client library

Installation

;; Add to dependencies
[cljs-ipfs-api "0.0.12-SNAPSHOT"]
(ns my.app
  (:require 
  [cljs-ipfs-api.core :as icore :refer [init-ipfs-node]] ;;Or init-ipfs-web for web
  [cljs-ipfs-api.files :as ifiles]))

Usage

So basically, stick with the js-ipfs-api docs, all methods there have their kebab-cased version in this library. Also, return values and responses in callbacks are automatically kebab-cased and keywordized. You can provide IPFS instance as an additional first argument to each function, in case you'd need more than one connection:

Example call

(init-ipfs-node "/ip4/127.0.0.1/tcp/5001")
(ifiles/fls "/ipfs/QmYwAPJzv5CZsnA625s3Xf2nemtYgPpHdWEz79ojWnPbdG/" (fn [err files]
                                                                      (info [err "ERROR"])
                                                                      (info [files "FILES"])))

cljs.core.async integration

You can also provide an async channel instead of the callback function