atomicfile

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: May 17, 2016 License: BSD-3-Clause, MIT Imports: 3 Imported by: 0

README

Documentation

Overview

Package atomicfile provides the ability to write a file with an eventual rename on Close. This allows for a file to always be in a consistent state and never represent an in-progress write.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	*os.File
	// contains filtered or unexported fields
}

File behaves like os.File, but does an atomic rename operation at Close.

func New

func New(path string, mode os.FileMode) (*File, error)

New creates a new temporary file that will replace the file at the given path when Closed.

func (*File) Abort

func (f *File) Abort() error

Abort closes the file and removes it instead of replacing the configured file. This is useful if after starting to write to the file you decide you don't want it anymore.

func (*File) Close

func (f *File) Close() error

Close the file replacing the configured file.

Jump to

Keyboard shortcuts

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