bittorrent / go-btfs-api

Go interface to BTFS HTTP API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

go-btfs-api

Go interface to BTFS HTTP API

Install

go get -u github.com/bittorrent/go-btfs-api

This will download the source into $GOPATH/src/github.com/bittorrent/go-btfs-api.

Usage

See the godocs for details on available methods.

Example

Add a file with the contents "hello world!":

package main

import (
	"fmt"
	"strings"
	"os"

	shell "github.com/bittorrent/go-btfs-api"
)

func main() {
	// Where your local node is running on localhost:5001
	sh := shell.NewShell("localhost:5001")
	cid, err := sh.Add(strings.NewReader("hello world!"))
	if err != nil {
        fmt.Fprintf(os.Stderr, "error: %s", err)
        os.Exit(1)
	}
    fmt.Printf("added %s", cid)
}

For a more complete example, please see: https://github.com/bittorrent/go-btfs-api/blob/master/tests/main.go

Contribute

Contributions are welcome! Please check out the issues.

License

MIT @ Bittorrent.

About

Go interface to BTFS HTTP API

License:MIT License


Languages

Language:Go 100.0%