unixfs

package
v0.4.13-rc1 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2017 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package format implements a data format for files in the IPFS filesystem It is not the only format in ipfs, but it is the one that the filesystem assumes

Index

Constants

View Source
const (
	TRaw       = pb.Data_Raw
	TFile      = pb.Data_File
	TDirectory = pb.Data_Directory
	TMetadata  = pb.Data_Metadata
	TSymlink   = pb.Data_Symlink
	THAMTShard = pb.Data_HAMTShard
)

Variables

View Source
var ErrInvalidDirLocation = errors.New("found directory node in unexpected place")
View Source
var ErrMalformedFileFormat = errors.New("malformed data in file format")
View Source
var ErrUnrecognizedType = errors.New("unrecognized node type")

Functions

func BytesForMetadata

func BytesForMetadata(m *Metadata) ([]byte, error)

func DataSize

func DataSize(data []byte) (uint64, error)

func EmptyDirNode added in v0.4.3

func EmptyDirNode() *dag.ProtoNode

func FilePBData

func FilePBData(data []byte, totalsize uint64) []byte

func FolderPBData

func FolderPBData() []byte

FolderPBData returns Bytes that represent a Directory.

func FromBytes

func FromBytes(data []byte) (*pb.Data, error)

func SymlinkData added in v0.3.8

func SymlinkData(path string) ([]byte, error)

SymlinkData returns a `Data_Symlink` protobuf message for the path you specify.

func UnwrapData

func UnwrapData(data []byte) ([]byte, error)

func WrapData

func WrapData(b []byte) []byte

WrapData marshals raw bytes into a `Data_Raw` type protobuf message.

Types

type FSNode added in v0.3.2

type FSNode struct {
	Data []byte

	// node type of this node
	Type pb.Data_DataType
	// contains filtered or unexported fields
}

func FSNodeFromBytes added in v0.3.2

func FSNodeFromBytes(b []byte) (*FSNode, error)

func (*FSNode) AddBlockSize added in v0.3.2

func (n *FSNode) AddBlockSize(s uint64)

AddBlockSize adds the size of the next child block of this node

func (*FSNode) FileSize added in v0.3.2

func (n *FSNode) FileSize() uint64

func (*FSNode) GetBytes added in v0.3.2

func (n *FSNode) GetBytes() ([]byte, error)

func (*FSNode) NumChildren added in v0.3.2

func (n *FSNode) NumChildren() int

func (*FSNode) RemoveBlockSize added in v0.3.2

func (n *FSNode) RemoveBlockSize(i int)

type Metadata

type Metadata struct {
	MimeType string
	Size     uint64
}

func MetadataFromBytes

func MetadataFromBytes(b []byte) (*Metadata, error)

MetadataFromBytes Unmarshals a protobuf message into Metadata.

func (*Metadata) Bytes

func (m *Metadata) Bytes() ([]byte, error)

Directories

Path Synopsis
tar
Package hamt implements a Hash Array Mapped Trie over ipfs merkledag nodes.
Package hamt implements a Hash Array Mapped Trie over ipfs merkledag nodes.
package unixfs/io implements convenience objects for working with the ipfs unixfs data format.
package unixfs/io implements convenience objects for working with the ipfs unixfs data format.
Package unixfs_pb is a generated protocol buffer package.
Package unixfs_pb is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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