Skip to content

Latest commit

 

History

History
69 lines (46 loc) · 2.45 KB

README.md

File metadata and controls

69 lines (46 loc) · 2.45 KB

go-ipfs-api

This repository is a modified version of go-ipfs-api that may/may not contain code in upstream (ipfs/go-ipfs-api not RTradeLtd/go-ipfs-api).

readme from upstream

standard-readme compliant GoDoc Build Status

An unofficial go interface to ipfs's HTTP API

Install

go get -u github.com/ipfs/go-ipfs-api

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

Usage

See the godocs for details on available methods. This should match the specs at ipfs/specs; however, there are still some methods which are not accounted for. If you would like to add any of them, see the contribute section below.

Example

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

package main

import (
	"fmt"
	"strings"
    	"os"

    	shell "github.com/ipfs/go-ipfs-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/ipfs/go-ipfs-api/blob/master/tests/main.go

Contribute

Contributions are welcome! Please check out the issues.

Want to hack on IPFS?

License

MIT