unixfs

package
Version: v0.3.7 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2015 License: MIT Imports: 3 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
)

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 FilePBData

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

func FolderPBData

func FolderPBData() []byte

Returns Bytes that represent a Directory

func FromBytes

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

func UnwrapData

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

func WrapData

func WrapData(b []byte) []byte

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)

func (*Metadata) Bytes

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

Source Files

Directories

Path Synopsis
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
t or T : Toggle theme light dark auto
y or Y : Canonical URL