tmpwriter

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Touch

func Touch(path string) error

Touch a file, like the Unix `touch` utility.

Types

type TmpWriter

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

Implements `io.Writer`, `io.StringWriter`, `io.WriteCloser`. Writes to a temp file so that calling `Reset` instead of `Close` leaves the original file in place.

func Make

func Make(path string) (TmpWriter, error)

Create a new TmpWriter.

func (*TmpWriter) Close

func (f *TmpWriter) Close() error

Close the file. The file change is atomic, via `os.Rename`.

func (*TmpWriter) Len

func (f *TmpWriter) Len() int

Len returns the current file length.

func (*TmpWriter) Reset

func (f *TmpWriter) Reset() error

Discard any changes to the file.

func (*TmpWriter) Write

func (f *TmpWriter) Write(p []byte) (int, error)

Write implements the standard Write interface.

func (*TmpWriter) WriteString

func (f *TmpWriter) WriteString(s string) (int, error)

WriteString implements the standard WriteString interface.

Jump to

Keyboard shortcuts

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