utils

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2023 License: Apache-2.0, MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const UnixfsChunkSize uint64 = 1 << 20
View Source
const UnixfsLinksPerLevel = 1 << 10

Variables

View Source
var Blue = "\033[34m"
View Source
var Cyan = "\033[36m"
View Source
var Gray = "\033[37m"
View Source
var Green = "\033[32m"
View Source
var Purple = "\033[35m"
View Source
var Red = "\033[31m"
View Source
var Reset = "\033[0m"
View Source
var White = "\033[97m"
View Source
var Yellow = "\033[33m"

Functions

func BuildFileNode added in v1.0.2

func BuildFileNode(ctx context.Context, item Finfo, bufDs ipld.DAGService, cidBuilder cid.Builder) (node ipld.Node, err error)

func PrettyEncode added in v1.0.2

func PrettyEncode(data interface{}, out io.Writer) error

PrettyEncode Encoding the data into JSON format and writing it to the output stream.

Types

type CidMapValue added in v1.0.2

type CidMapValue struct {
	IsDir bool   `json:"is_dir"`
	Cid   string `json:"cid"`
}

type FSBuilder added in v1.0.2

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

func NewFSBuilder added in v1.0.2

func NewFSBuilder(root *dag.ProtoNode, ds ipld.DAGService) *FSBuilder

func (*FSBuilder) Build added in v1.0.2

func (b *FSBuilder) Build() (rootn *FsNode, err error)

type Finfo added in v1.0.2

type Finfo struct {
	Path  string
	Size  int64
	Start int64
	End   int64
}

type FsNode added in v1.0.2

type FsNode struct {
	Name string
	Hash string
	Size uint64
	Link []FsNode
}

func GenerateCar added in v1.0.2

func GenerateCar(ctx context.Context, fileList []Finfo, parentPath string, tmpDir string, output io.Writer) (ipldDag *FsNode, cid string, cidMap map[string]CidMapValue, err error)

Jump to

Keyboard shortcuts

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