MCPcopy Create free account
hub / github.com/containers/image / temporaryDirectoryForBigFiles

Function temporaryDirectoryForBigFiles

internal/tmpdir/tmpdir.go:25–36  ·  view source on GitHub ↗

TemporaryDirectoryForBigFiles returns a directory for temporary (big) files. On non Windows systems it avoids the use of os.TempDir(), because the default temporary directory usually falls under /tmp which on systemd based systems could be the unsuitable tmpfs filesystem.

(sys *types.SystemContext)

Source from the content-addressed store, hash-verified

23// On non Windows systems it avoids the use of os.TempDir(), because the default temporary directory usually falls under /tmp
24// which on systemd based systems could be the unsuitable tmpfs filesystem.
25func temporaryDirectoryForBigFiles(sys *types.SystemContext) string {
26 if sys != nil && sys.BigFilesTemporaryDir != "" {
27 return sys.BigFilesTemporaryDir
28 }
29 var temporaryDirectoryForBigFiles string
30 if runtime.GOOS == "windows" {
31 temporaryDirectoryForBigFiles = os.TempDir()
32 } else {
33 temporaryDirectoryForBigFiles = unixTempDirForBigFiles
34 }
35 return temporaryDirectoryForBigFiles
36}
37
38func CreateBigFileTemp(sys *types.SystemContext, name string) (*os.File, error) {
39 return os.CreateTemp(temporaryDirectoryForBigFiles(sys), prefix+name)

Callers 2

CreateBigFileTempFunction · 0.85
MkDirBigFileTempFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…