Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CreateFail ¶
type CreateFail struct {
// contains filtered or unexported fields
}
CreateFail describes file creation failure.
func (CreateFail) Error ¶
func (e CreateFail) Error() (s string)
func (CreateFail) Unwrap ¶
func (e CreateFail) Unwrap() (err error)
type Files ¶
type Files struct {
// Path to the root directory
RootDir path.Dir
// random number generator for generating random file names
rand.Rand
// contains filtered or unexported fields
}
Files is the main struct for managing temporary files in a single directory.
func FromDir ¶
FromDir sets up temporary file management for the specified directory with the given randum number generator.
func FromRand ¶
FromRand sets up temporary file management with the specified random number generator. Directory name will be randomly generated using the generator.
func NewDefault ¶
NewDefault sets up temporary file management with default parameters. random number generator will be produced using the current unix time stamp.
func (*Files) Get ¶
Get retreives a new temporary file to be used. First it searches for a file that is not in use. If no such file is found a new file will be created and registered in the receivers fileset.
func (*Files) NewFile ¶
NewFile creates a new file to be used in the temporary file directory. Returns error if file creation has failed.
func (*Files) Put ¶
Put signals to the receiver that the temporary file is no longer in use. Should be used in conjunction with Get.
var t = NewDefaultTempFiles()
f, err := t.Get()
if err != nil {
// error handling
}
defer t.Put(f)
// use f
type Mutexed ¶
type Mutexed struct {
// contains filtered or unexported fields
}
Mutexed is concurrent safe Files, guarded by mutex
type RNG ¶
func (RNG) ApplyToTempFiles ¶
type WithExtension ¶
type WithExtension struct {
Like
// contains filtered or unexported fields
}