ipfs

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2021 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DirWalker

type DirWalker func(file *File) error

type File

type File struct {
	Type
	// contains filtered or unexported fields
}

func (*File) Name

func (f *File) Name() string

func (*File) Path

func (f *File) Path() string

func (*File) Prefix

func (f *File) Prefix() string

func (*File) Read

func (f *File) Read() ([]byte, error)

type FileApi

type FileApi struct {
	// contains filtered or unexported fields
}

func NewFileApi

func NewFileApi(ipfs *Ipfs, db *leveldb.DB) *FileApi

func (*FileApi) AddDir

func (f *FileApi) AddDir(context context.Context, sourceDirPath string) (*File, error)

func (*FileApi) AddFile

func (f *FileApi) AddFile(context context.Context, sourcePath string) (*File, error)

func (*FileApi) GetFile

func (f *FileApi) GetFile(context context.Context, file path.Path) (*File, error)

func (*FileApi) RootPath

func (f *FileApi) RootPath(fileName string) path.Path

RootPath returns IPFS path from the file name

func (*FileApi) WalkDirTree

func (f *FileApi) WalkDirTree(context context.Context, parent *File, walker DirWalker) error

type Ipfs

type Ipfs struct {
	CoreAPI *icore.CoreAPI
	*FileApi
	*ipfsconfig.IpfsOptions
	// contains filtered or unexported fields
}

func (*Ipfs) ConnectToPeers

func (i *Ipfs) ConnectToPeers(ctx context.Context, peers []string) error

func (*Ipfs) CoreApi

func (i *Ipfs) CoreApi() *icore.CoreAPI

func (*Ipfs) FilesApi

func (i *Ipfs) FilesApi() *FileApi

type IpfsApi

type IpfsApi interface {
	FilesApi() *FileApi
	CoreApi() *icore.CoreAPI
}

func StartIpfsNode

func StartIpfsNode(ctx context.Context, options ipfsconfig.IpfsOptions) (IpfsApi, error)

StartIpfsNode starts a new IPFS ipfs (default or ephemeral), connecting to it configured peers, and wraps an API to add or get ipfs and directories.

type Type

type Type int
const (
	SymbolicLinkType Type = iota
	FileType
	DirType
)

Jump to

Keyboard shortcuts

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