tempfile

package
v2.4.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 11, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const FinalMode = 0664

The final permissions of the cache files, once they have finished being uploaded.

Variables

This section is empty.

Functions

This section is empty.

Types

type Creator

type Creator struct {
	// contains filtered or unexported fields
}

Creator maintains the state of a pseudo-random number generator used to create temp files.

func NewCreator

func NewCreator() *Creator

NewCreator returns a new Creator, for creating temp files.

func (*Creator) Create

func (c *Creator) Create(base string, legacy bool) (*os.File, string, error)

Create attempts to create a file whose name is of the form <base>-<randomstring> and with a ".v1" suffix if `legacy` is true. The file will be created with the setgid bit set, which indicates that it is not complete. The *os.File is returned along with the random string, and an error if something went wrong.

Once the file has been successfully written by the caller, it should be chmod'ed to `FinalMode` to mark it as complete.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL