write

package module
v0.0.0-...-56629a6 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2018 License: Apache-2.0 Imports: 1 Imported by: 1 module, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

This package has moved! Please see https://github.com/google/renameio instead.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Symlink(oldname, newname string) error

Symlink wraps os.Symlink, replacing an existing symlink with the same name atomically (os.Symlink fails when newname already exists, at least on Linux).

func TempDir

func TempDir(dest string) string

TempDir checks whether os.TempDir() can be used as a temporary directory for later atomically replacing files within dest. If no (os.TempDir() resides on a different mount point), dest is returned.

Note that the returned value ceases to be valid once either os.TempDir() changes (e.g. on Linux, once the TMPDIR environment variable changes) or the file system is unmounted.

Types

type PendingFile

type PendingFile = renameio.PendingFile

PendingFile is a pending temporary file, waiting to replace the destination path in a call to CloseAtomicallyReplace.

func TempFile

func TempFile(dir, path string) (*PendingFile, error)

TempFile wraps ioutil.TempFile for the use case of atomically creating or replacing the destination file at path.

If dir is the empty string, TempDir(filepath.Base(path)) is used. If you are going to write a large number of files to the same file system, store the result of TempDir(filepath.Base(path)) and pass it instead of the empty string.

Jump to

Keyboard shortcuts

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