file

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var UnopenedReadErr = errors.New("attempted to read unopened file")

Functions

This section is empty.

Types

type FileReader

type FileReader struct {
	// Paths is optional if Name, Ext and MimeType are provided
	// If more than one path is given, then all paths will be archived
	Paths []string

	// Name is optional if Path is provided
	Name string
	// Ext is optional if Path is provided
	Ext string
	// MimeType is optional if Path is provided
	MimeType string

	// ProgressWriter will be used to output read progress
	// whenever this File structs Read() method is called.
	ProgressWriter io.Writer

	ArchiveMethod string
	// contains filtered or unexported fields
}

FileReader represents the file being sent, whether its from an actual file or stdin. FileReader also holds the files metadata.

func (*FileReader) Close

func (f *FileReader) Close() error

func (*FileReader) GetProgress added in v1.4.1

func (f *FileReader) GetProgress() int64

func (*FileReader) Lock

func (f *FileReader) Lock()

func (*FileReader) Open

func (f *FileReader) Open() error

Open prepares the files contents for reading. If f.file is the empty string then f.Open() will read from stdin into a buffer. This method is idempotent.

func (*FileReader) Read

func (f *FileReader) Read(p []byte) (n int, err error)

func (*FileReader) ReadCount

func (f *FileReader) ReadCount() int

ReadCount returns how many times the file has been read

func (*FileReader) RequestCount

func (f *FileReader) RequestCount() int

func (*FileReader) Requested

func (f *FileReader) Requested()

Requested increases the request count by one

func (*FileReader) Reset

func (f *FileReader) Reset() error

func (*FileReader) Size

func (f *FileReader) Size() int64

func (*FileReader) Unlock

func (f *FileReader) Unlock()

type FileWriter

type FileWriter struct {
	// Path is optional if Name, Ext and MimeType are provided
	Path string

	MIMEType string

	// ProgressWriter will be used to output read progress
	// whenever this File structs Read() method is called.
	ProgressWriter io.Writer

	sync.Mutex
	// contains filtered or unexported fields
}

FileWriter represents the file being received, whether its to an actual file or stdout. File also holds the files metadata.

func (*FileWriter) Close

func (f *FileWriter) Close() error

func (*FileWriter) GetLocation

func (f *FileWriter) GetLocation() string

func (*FileWriter) GetProgress added in v1.4.1

func (f *FileWriter) GetProgress() int64

func (*FileWriter) GetSize

func (f *FileWriter) GetSize() int64

func (*FileWriter) Name

func (f *FileWriter) Name() string

func (*FileWriter) Open

func (f *FileWriter) Open() error

Open prepares the files contents for reading. If f.file is the empty string then f.Open() will read from stdin into a buffer. This method is idempotent.

func (*FileWriter) Reset

func (f *FileWriter) Reset() error

func (*FileWriter) SetName

func (f *FileWriter) SetName(name string, fromRemote bool)

func (*FileWriter) SetSize

func (f *FileWriter) SetSize(size int64)

func (*FileWriter) Write

func (f *FileWriter) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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