kubo/client/rpc
2023-10-09 09:44:39 +02:00
..
api_test.go feat: path consolidation (#10063) 2023-10-06 16:14:44 +02:00
api.go fix: use %-encoded headers in most compatible way 2023-08-22 15:43:01 +02:00
apifile.go feat: path consolidation (#10063) 2023-10-06 16:14:44 +02:00
block.go feat: path consolidation (#10063) 2023-10-06 16:14:44 +02:00
dag.go feat: path consolidation (#10063) 2023-10-06 16:14:44 +02:00
dht.go feat: path consolidation (#10063) 2023-10-06 16:14:44 +02:00
errors_test.go client/rpc: rename package name to match rpc and edit migration story 2023-05-31 15:40:00 +02:00
errors.go style: gofumpt and godot [skip changelog] (#10081) 2023-08-17 14:02:08 +02:00
key.go feat: path consolidation (#10063) 2023-10-06 16:14:44 +02:00
name.go feat: path consolidation (#10063) 2023-10-06 16:14:44 +02:00
object.go chore: update boxo for structification of ImmutablePath 2023-10-09 09:44:39 +02:00
path.go chore: update boxo for structification of ImmutablePath 2023-10-09 09:44:39 +02:00
pin.go feat: path consolidation (#10063) 2023-10-06 16:14:44 +02:00
pubsub.go style: gofumpt and godot [skip changelog] (#10081) 2023-08-17 14:02:08 +02:00
README.md client/rpc: rename package name to match rpc and edit migration story 2023-05-31 15:40:00 +02:00
request.go client/rpc: rename package name to match rpc and edit migration story 2023-05-31 15:40:00 +02:00
requestbuilder.go fix: use %-encoded headers in most compatible way 2023-08-22 15:43:01 +02:00
response.go style: gofumpt and godot [skip changelog] (#10081) 2023-08-17 14:02:08 +02:00
routing.go style: gofumpt and godot [skip changelog] (#10081) 2023-08-17 14:02:08 +02:00
swarm.go refactor: stop using go-libp2p deprecated peer.ID.Pretty 2023-09-18 15:58:15 +02:00
unixfs.go chore: update boxo for structification of ImmutablePath 2023-10-09 09:44:39 +02:00

coreiface.CoreAPI over http rpc

IPFS CoreAPI implementation using HTTP API

This packages implements coreiface.CoreAPI over the HTTP API.

Documentation

https://pkg.go.dev/github.com/ipfs/kubo/client/rpc

Example

Pin file on your local IPFS node based on its CID:

package main

import (
    "context"
    "fmt"

    "github.com/ipfs/kubo/client/rpc"
    path "github.com/ipfs/boxo/coreiface/path"
)

func main() {
    // "Connect" to local node
    node, err := rpc.NewLocalApi()
    if err != nil {
        fmt.Printf(err)
        return
    }
    // Pin a given file by its CID
    ctx := context.Background()
    cid := "bafkreidtuosuw37f5xmn65b3ksdiikajy7pwjjslzj2lxxz2vc4wdy3zku"
    p := path.New(cid)
    err = node.Pin().Add(ctx, p)
    if err != nil {
    	fmt.Printf(err)
        return
    }
    return
}