ipfs_client

package
v0.0.0-...-c9801ce Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 25, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IpfsClient

type IpfsClient struct {
	NodeHttpApi *rpc.HttpApi
	// contains filtered or unexported fields
}

IpfsClient is a wrapper around the IPFS node HTTP API. It provides convenient methods for interacting with the IPFS node.

func NewIpfsClient

func NewIpfsClient(configPath string) (*IpfsClient, error)

NewIpfsClient creates a new IpfsClient instance.

func (*IpfsClient) AddAndPinFile

func (c *IpfsClient) AddAndPinFile(ctx context.Context, msg proto.Message) (string, error)

AddAndPinFile adds a protobuf message to IPFS and pins it.

func (*IpfsClient) AddAndPinFileBytes

func (c *IpfsClient) AddAndPinFileBytes(ctx context.Context, byteArray []byte) (string, error)

AddAndPinFileBytes adds a byte array to the IPFS and pins it.

func (*IpfsClient) AddFile

func (c *IpfsClient) AddFile(ctx context.Context, msg proto.Message) (string, error)

AddFile adds a protobuf message to IPFS and returns its CID.

func (*IpfsClient) AddFileBytes

func (c *IpfsClient) AddFileBytes(ctx context.Context, byteArray []byte) (string, error)

AddFileBytes adds a byte array to IPFS and returns its CID.

func (*IpfsClient) GetFile

func (c *IpfsClient) GetFile(ctx context.Context, cid string, msg proto.Message) error

GetFile retrieves a protobuf message from IPFS, unmarshals it and leaves the result in msg.

func (*IpfsClient) PinFile

func (c *IpfsClient) PinFile(ctx context.Context, cid string) error

PinFile pins a CID to the local IPFS node. Without pinning, the data related to the CID will be stored in the IPFS but will get deleted by the garbage collector later on. Pinning the CID will prevent this from happening.

func (*IpfsClient) UnpinFile

func (c *IpfsClient) UnpinFile(ctx context.Context, cid string) error

UnpinFile removes a pin for a CID from the local IPFS node, letting the garbage collector delete the data related to the CID.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL