Documentation
¶
Overview ¶
Package seekbuf buffers an io.Reader into a seekable, randomly addressable resource, either in memory or backed by a temporary file.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var InMemoryFactory = FactoryFunc(NewInMemoryBuffer)
Functions ¶
func SetDefault ¶
func SetDefault(f Factory)
Types ¶
type Buffer ¶
type Buffer interface {
Get() (ReadSeekAtCloser, error)
Destroy() error
}
Buffer represents a resource that can be accessed via io interfaces and destroyed if no longer needed.
func New ¶
New creates a new Buffer that buffers an io.Reader into a ReadSeekAtCloser (seekable and randomly addressable via io.ReaderAt, e.g. for use with io.NewSectionReader) by either buffering it in memory or writing it to a temporary file.
type Factory ¶
var Default Factory = InMemoryFactory
type FactoryFunc ¶
type FileBufferFactory ¶
type FileBufferFactory struct {
Dir string
}
FileBufferFactory creates [Buffer]s for temporary files in Dir. If Dir is the empty string, the default directory for temporary files is used (see os.TempDir).
type ReadSeekAt ¶
type ReadSeekAt interface {
io.ReadSeeker
io.ReaderAt
}
type ReadSeekAtCloser ¶
type ReadSeekAtCloser interface {
ReadSeekAt
io.Closer
}
Click to show internal directories.
Click to hide internal directories.