renameio

package
v0.0.0-...-054a03c Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package renameio writes files atomically by renaming temporary files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Pattern

func Pattern(filename string) string

Pattern returns a glob pattern that matches the unrenamed temporary files created when writing to filename.

func WriteFile

func WriteFile(filename string, data []byte) (err error)

WriteFile is like ioutil.WriteFile, but first writes data to an arbitrary file in the same directory as filename, then renames it atomically to the final name.

That ensures that the final location, if it exists, is always a complete file.

func WriteToFile

func WriteToFile(filename string, data io.Reader) (err error)

WriteToFile is a variant of WriteFile that accepts the data as an io.Reader instead of a slice.

Types

This section is empty.

Jump to

Keyboard shortcuts

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