Skip to content
This repository was archived by the owner on Feb 7, 2024. It is now read-only.
/ go-ipfs-api Public archive

The go interface to ipfs's HTTP API

License

Notifications You must be signed in to change notification settings

ipfs/go-ipfs-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

1bb8632 · Feb 7, 2024
Aug 23, 2023
Jun 27, 2023
Nov 22, 2017
Apr 6, 2023
Sep 17, 2021
Mar 22, 2016
Feb 7, 2024
Aug 22, 2023
Jul 16, 2018
Aug 22, 2023
Aug 23, 2023
Aug 22, 2023
Jul 16, 2018
Jul 16, 2021
Aug 22, 2023
Feb 21, 2023
Aug 22, 2023
Mar 28, 2023
Feb 21, 2023
Apr 6, 2023
Feb 14, 2019
Jul 16, 2018
Aug 22, 2023
Aug 22, 2023
Jul 16, 2018
Aug 22, 2023

Repository files navigation

⚠️ This package is no longer being maintained ⚠️

Please use kubo/client/rpc instead. In rare case the new library does not offer a feature this one does, fill issue in Kubo, or better, submit a PR that adds it to kubo/client/rpc.

For more details about the decision, see ipfs/kubo#9124.

go-ipfs-api

standard-readme compliant GoDoc Build Status

The go interface to ipfs's HTTP API

Install

go install github.com/ipfs/go-ipfs-api@latest

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 (Core API); 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. See also the HTTP API.

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