unixfs

package
v0.3.8-dev-trailers Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2015 License: MIT Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 SymlinkData added in v0.3.8

func SymlinkData(path string) ([]byte, 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)

Directories

Path Synopsis
tar
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