tempfile

package
v3.65.0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

package tempfile provides a way to create temporary files preserving extension and setting permissions

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(opts ...Opts) (*os.File, error)

New creates a temporary file with the provided options.

func NewClosed

func NewClosed(opts ...Opts) (string, error)

NewClosed creates a temporary file with the provided options and closes it.

Types

type Opts

type Opts func(*request)

func KeepingExtension

func KeepingExtension() Opts

KeepingExtension ensures the extension of the filename is preserved when creating the temporary file. It has not affect if `WithName` is not also used.

func WithDir

func WithDir(dir string) Opts

WithDir sets the subdirectory of the temporary file within the system temp directory.

func WithName

func WithName(filename string) Opts

WithName sets the filename of the temporary file.

func WithPerms

func WithPerms(perms fs.FileMode) Opts

WithPerms sets the permissions of the temporary file.

Jump to

Keyboard shortcuts

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