dfile

package
v0.0.0-...-c152b52 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AtomicSave

func AtomicSave(dest string, src io.Reader, mode os.FileMode) error

AtomicSave saves src to the file making sure that the file saving is all-or-nothing.

func AtomicSaveBytes

func AtomicSaveBytes(dest string, content []byte, mode os.FileMode) error

AtomicSaveBytes is AtomicSave(bytes.NewReader(content))

func AtomicSaveDirWith

func AtomicSaveDirWith(dest string, mode os.FileMode, handler func(tempDir string) error) error

AtomicSaveDirWith atomically saves contents written to tempDir

func AtomicSaveFromFile

func AtomicSaveFromFile(dest string, handler func(tempFileName string) error) error

AtomicSaveFromFile atomically saves the file written to tempFile to dest

func AtomicSaveString

func AtomicSaveString(dest string, content string, mode os.FileMode) error

AtomicSaveString is AtomicSave(strings.NewReader(content))

func AtomicSaveWith

func AtomicSaveWith(dest string, mode os.FileMode, handler func(dest io.Writer) error) error

AtomicSaveWith atomically saves content written to dest

func Exists

func Exists(file string) (bool, error)

Exists returns whether the file exists

func RemoveIfExists

func RemoveIfExists(filename string) error

RemoveIfExists removes the given file, reporting success if the file does not exist.

func SymlinkIfNot

func SymlinkIfNot(oldname string, newname string) error

SymlinkIfNot creates a symlink at newname pointing to oldname.

It returns success if newname is already a symlink pointing to oldname, and error on any other kind of error.

Types

This section is empty.

Jump to

Keyboard shortcuts

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