fs

package
v1.5.37 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AtomicWriter

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

func NewAtomicWriter

func NewAtomicWriter(filename string) (*AtomicWriter, error)

NewAtomicWriter returns an io.WriteCloser that will write contents to a temp file and move that temp file to the destination filename. If the destination filename already exists, this constructor will copy the file to <filename>-old, truncating that file if it already exists.

func (*AtomicWriter) Close

func (a *AtomicWriter) Close() error

Close closes the temp file handle and moves the temp file to the final destination

func (*AtomicWriter) Write

func (a *AtomicWriter) Write(p []byte) (int, error)

Write writes the buffer to the temp file. You must call Close() to complete the move from temp file to dest file

Jump to

Keyboard shortcuts

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