io

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: May 10, 2015 License: MIT Imports: 12 Imported by: 1

Documentation

Overview

package unixfs/io implements convenience objects for working with the ipfs unixfs data format.

Index

Constants

This section is empty.

Variables

View Source
var ErrIsDir = errors.New("this dag node is a directory")

Functions

func NewDirectory

func NewDirectory(dserv mdag.DAGService) *directoryBuilder

NewDirectory returns a directoryBuilder. It needs a DAGService to add the Children

func NewEmptyDirectory added in v0.3.4

func NewEmptyDirectory() *mdag.Node

NewEmptyDirectory returns an empty merkledag Node with a folder Data chunk

Types

type DagReader

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

DagReader provides a way to easily read the data contained in a dag.

func NewDagReader

func NewDagReader(ctx context.Context, n *mdag.Node, serv mdag.DAGService) (*DagReader, error)

NewDagReader creates a new reader object that reads the data represented by the given node, using the passed in DAGService for data retreival

func (*DagReader) Close

func (dr *DagReader) Close() error

func (*DagReader) CtxReadFull added in v0.3.2

func (dr *DagReader) CtxReadFull(ctx context.Context, b []byte) (int, error)

CtxReadFull reads data from the DAG structured file

func (*DagReader) Read

func (dr *DagReader) Read(b []byte) (int, error)

Read reads data from the DAG structured file

func (*DagReader) Seek

func (dr *DagReader) Seek(offset int64, whence int) (int64, error)

Seek implements io.Seeker, and will seek to a given offset in the file interface matches standard unix seek TODO: check if we can do relative seeks, to reduce the amount of dagreader recreations that need to happen.

func (*DagReader) Size

func (dr *DagReader) Size() int64

Size return the total length of the data from the DAG structured file.

func (*DagReader) WriteTo

func (dr *DagReader) WriteTo(w io.Writer) (int64, error)

type ReadSeekCloser

type ReadSeekCloser interface {
	io.Reader
	io.Seeker
	io.Closer
	io.WriterTo
}

func NewRSNCFromBytes

func NewRSNCFromBytes(b []byte) ReadSeekCloser

Jump to

Keyboard shortcuts

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