unixfs

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2021 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ObjectsPath = "objects"
	RefsPath    = "refs"
	InfoPath    = "info"
	PackPath    = "pack"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Unixfs

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

Unixfs is used to read and write to a unixfs directory.

func Load

func Load(ctx context.Context, ds ipld.DAGService, id cid.Cid) (*Unixfs, error)

Load returns an existing unixfs using the directory with the given id.

func New

func New(ctx context.Context, ds ipld.DAGService) (*Unixfs, error)

New returns a new unixfs directory initialized with empty directories.

func (*Unixfs) Find

func (fs *Unixfs) Find(fpath string) (ipld.Node, error)

Find returns the node at the given path.

func (*Unixfs) Module

func (fs *Unixfs) Module() (*Unixfs, error)

Module returns a new unixfs for a submodule

func (*Unixfs) Node

func (fs *Unixfs) Node() (ipld.Node, error)

Save writes the final unixfs to the dag service.

func (*Unixfs) Read

func (fs *Unixfs) Read(fpath string) (io.ReadCloser, error)

Read returns a reader for the file at the given path.

func (*Unixfs) Remove

func (fs *Unixfs) Remove(fpath string) error

Remove removes the node at the given path.

func (*Unixfs) Walk

func (fs *Unixfs) Walk(fpath string, cb WalkFun) error

Walk walks the directory at the given path and invokes the callback for each entry.

func (*Unixfs) Write

func (fs *Unixfs) Write(fpath string, r io.Reader) error

Write writes the contents of the given reader to the path.

type WalkFun

type WalkFun func(string, *ufs.FSNode) error

WalkFun is called for each directory entry.

Jump to

Keyboard shortcuts

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