fs

package
v0.0.5 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(ctx context.Context, ds ipld.DAGService, path string, filter ignore.Filter) (ipld.Node, error)

Add creates a node from the file at path and adds it to the merkle dag.

func Cat

func Cat(ctx context.Context, dag ipld.DAGService, id cid.Cid) (string, error)

Cat returns the contents of the file with the given CID.

func Write

func Write(ctx context.Context, dag ipld.DAGService, path string, node ipld.Node) error

Write writes the contents of node to the path.

Types

type ByTypeAndName

type ByTypeAndName []*DirEntry

ByTypeAndName is used to sort dir entries.

func (ByTypeAndName) Len

func (a ByTypeAndName) Len() int

Len returns the length of the slice.

func (ByTypeAndName) Less

func (a ByTypeAndName) Less(i, j int) bool

Less returns true if entry at index i is less than entry at index j.

func (ByTypeAndName) Swap

func (a ByTypeAndName) Swap(i, j int)

Swap swaps the indices of two entries.

type DirEntry

type DirEntry struct {
	// Cid is the id of the entry.
	Cid cid.Cid `json:"cid"`
	// Name is the name of the file.
	Name string `json:"name"`
	// IsDir indicates if the file is a directory.
	IsDir bool `json:"is_dir"`
	// Size is the size in bytes of the file.
	Size uint64 `json:"size"`
}

DirEntry contains info about a file.

func Ls

func Ls(ctx context.Context, dag ipld.DAGService, id cid.Cid) ([]*DirEntry, error)

Ls returns the contents of the directory with the given CID.

func Stat

func Stat(ctx context.Context, dag ipld.DAGService, link *ipld.Link) (*DirEntry, error)

Stat returns file info for the given link.

Jump to

Keyboard shortcuts

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