Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindAnyTempFileDirectory ¶
Try to find any temporary file directory, opting for 'preferred' if that is specified, and falling back to other guesses.
Types ¶
type TempFiles ¶
type TempFiles struct {
// contains filtered or unexported fields
}
TempFiles assigns temporary filenames, and automatically deletes old temporary files. We don't need to be too worried about aggressive deletion of temp files, because if a temp file is still being sent to a client, and we delete it, then the OS will do the right thing and not actually erase the file until the last handle is closed.
We manage two classes of temporary files:
- Once off: These are intended to be created, used, and deleted.
- Named: These are intended to be named with a hash, or something similarly unique. Named files live longer. This was created to cache transcoded videos with improved random seek behaviour in a browser <video> element. Naturally, we want this kind of thing to stick around for a while.
func NewTempFiles ¶
Wipes/recreates the root directory
func (*TempFiles) GetNamed ¶
Get a temporary filename for a named item. If you ask for the same name twice, you'll get back the same path. This function will guarantee that the named file will not be deleted for at least guaranteedLifetimeNamed. If the file already exists, then 'exists' is true.
func (*TempFiles) GetOnceOff ¶
Get a new temporary filename for a once-off file