Documentation
¶
Index ¶
- Variables
- type FileReader
- func (f *FileReader) Close() error
- func (f *FileReader) GetProgress() int64
- func (f *FileReader) Lock()
- func (f *FileReader) Open() error
- func (f *FileReader) Read(p []byte) (n int, err error)
- func (f *FileReader) ReadCount() int
- func (f *FileReader) RequestCount() int
- func (f *FileReader) Requested()
- func (f *FileReader) Reset() error
- func (f *FileReader) Size() int64
- func (f *FileReader) Unlock()
- type FileWriter
- func (f *FileWriter) Close() error
- func (f *FileWriter) GetLocation() string
- func (f *FileWriter) GetProgress() int64
- func (f *FileWriter) GetSize() int64
- func (f *FileWriter) Name() string
- func (f *FileWriter) Open() error
- func (f *FileWriter) Reset() error
- func (f *FileWriter) SetName(name string, fromRemote bool)
- func (f *FileWriter) SetSize(size int64)
- func (f *FileWriter) Write(p []byte) (n int, err error)
Constants ¶
This section is empty.
Variables ¶
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 ¶
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) 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 ¶
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)