mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-21 10:27:46 +08:00
* feat(key): add 'ipfs key ls' as alias for 'ipfs key list' Add 'ls' as an alias for the 'list' subcommand in 'ipfs key' to be consistent with other ipfs commands like 'ipfs repo ls' and 'ipfs pin ls' which use 'ls' instead of 'list'. Fixes #10976 Signed-off-by: Vedant Madane <6527493+VedantMadane@users.noreply.github.com> * feat(key): make 'ipfs key ls' canonical, deprecate 'list' aligns with other commands like 'ipfs pin ls' and 'ipfs files ls'. 'ipfs key list' still works but shows deprecation warning. * fix(key): correct --key option description in verify command was copy-pasted from sign command and said "signing" instead of "verifying" --------- Signed-off-by: Vedant Madane <6527493+VedantMadane@users.noreply.github.com> Co-authored-by: Marcin Rataj <lidel@lidel.org> |
||
|---|---|---|
| .. | ||
| auth | ||
| api_test.go | ||
| api.go | ||
| apifile.go | ||
| block.go | ||
| dag.go | ||
| errors_test.go | ||
| errors.go | ||
| key.go | ||
| name.go | ||
| object.go | ||
| path.go | ||
| pin.go | ||
| pubsub.go | ||
| README.md | ||
| request.go | ||
| requestbuilder.go | ||
| response.go | ||
| routing.go | ||
| swarm.go | ||
| unixfs.go | ||
coreiface.CoreAPI over http rpc
IPFS CoreAPI implementation using HTTP API
This package 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/boxo/path"
"github.com/ipfs/go-cid"
"github.com/ipfs/kubo/client/rpc"
)
func main() {
// "Connect" to local node
node, err := rpc.NewLocalApi()
if err != nil {
fmt.Println(err)
return
}
// Pin a given file by its CID
ctx := context.Background()
c, err := cid.Decode("bafkreidtuosuw37f5xmn65b3ksdiikajy7pwjjslzj2lxxz2vc4wdy3zku")
if err != nil {
fmt.Println(err)
return
}
p := path.FromCid(c)
err = node.Pin().Add(ctx, p)
if err != nil {
fmt.Println(err)
return
}
}