atomicwriter

package
v28.1.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New deprecated

func New(filename string, perm os.FileMode) (io.WriteCloser, error)

New returns a WriteCloser so that writing to it writes to a temporary file and closing it atomically changes the temporary file to destination path. Writing and closing concurrently is not allowed. NOTE: umask is not considered for the file's permissions.

New uses [sequential.CreateTemp] to use sequential file access on Windows, avoiding depleting the standby list un-necessarily. On Linux, this equates to a regular os.CreateTemp. Refer to the Win32 API documentation for details on sequential file access.

Deprecated: use atomicwriter.New instead.

func NewWriteSet deprecated

func NewWriteSet(tmpDir string) (*atomicwriter.WriteSet, error)

NewWriteSet creates a new atomic write set to atomically create a set of files. The given directory is used as the base directory for storing files before commit. If no temporary directory is given the system default is used.

Deprecated: use atomicwriter.NewWriteSet instead.

func WriteFile deprecated

func WriteFile(filename string, data []byte, perm os.FileMode) error

WriteFile atomically writes data to a file named by filename and with the specified permission bits. The given filename is created if it does not exist, but the destination directory must exist. It can be used as a drop-in replacement for os.WriteFile, but currently does not allow the destination path to be a symlink. WriteFile is implemented using New for its implementation.

NOTE: umask is not considered for the file's permissions.

Deprecated: use atomicwriter.WriteFile instead.

Types

type WriteSet deprecated

type WriteSet = atomicwriter.WriteSet

WriteSet is used to atomically write a set of files and ensure they are visible at the same time. Must be committed to a new directory.

Deprecated: use atomicwriter.WriteSet instead.

Jump to

Keyboard shortcuts

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