file

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2020 License: MIT Imports: 8 Imported by: 2 modules, 2 packages

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.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Append

func Append(path string, content ...interface{}) (int, error)

Append appends the contents to file

func Appendf

func Appendf(path string, format string, content ...interface{}) (int, error)

Appendf appends the contents to file with format

func Appendln

func Appendln(path string, content ...interface{}) (int, error)

Appendln appends the contents to file with newline

func Copy

func Copy(dest string, src ...string) error

Copy copy files

func Exist

func Exist(path string) bool

Exist detect the existence of a path

func Read

func Read(path string) (string, error)

Read read a file

func Write

func Write(path string, content ...interface{}) (int, error)

Write write to file

func WriteByte

func WriteByte(path string, content []byte) (int, error)

WriteByte write byte to file

func WriteByteTemp

func WriteByteTemp(pattern string, content []byte) (string, int, error)

WriteByteTemp write byte to temp file

func WriteTemp

func WriteTemp(pattern string, content ...interface{}) (string, int, error)

WriteTemp write to temp file

func Writef

func Writef(path string, format string, content ...interface{}) (int, error)

Writef write to file with format

func WritefTemp

func WritefTemp(pattern string, format string, content ...interface{}) (string, int, error)

WritefTemp write to temp file with format

func Writeln

func Writeln(path string, content ...interface{}) (int, error)

Writeln write to file with newline

func WritelnTemp

func WritelnTemp(pattern string, content ...interface{}) (path string, len int, err error)

WritelnTemp write to temp file with newline

Types

type Buffer

type Buffer struct {
	*strings.Builder
	// contains filtered or unexported fields
}

Buffer can store contents to a buffer and write them to path at one time

func NewBuffer

func NewBuffer(path string) *Buffer

NewBuffer create a buffer

func (*Buffer) Commit

func (buffer *Buffer) Commit() (int, error)

Commit buffer content to file

func (*Buffer) Set

func (buffer *Buffer) Set(content ...interface{}) (int, error)

Set set buffer content

func (*Buffer) Setf

func (buffer *Buffer) Setf(format string, content ...interface{}) (int, error)

Setf set buffer content with format

func (*Buffer) Setln

func (buffer *Buffer) Setln(content ...interface{}) (int, error)

Setln set buffer content with newline

func (*Buffer) WriteString

func (buffer *Buffer) WriteString(content ...interface{}) (int, error)

WriteString appends the contents to buffer

func (*Buffer) WriteStringf

func (buffer *Buffer) WriteStringf(format string, content ...interface{}) (int, error)

WriteStringf appends the contents to buffer with format

func (*Buffer) WriteStringln

func (buffer *Buffer) WriteStringln(content ...interface{}) (int, error)

WriteStringln appends the contents to buffer with newline

Jump to

Keyboard shortcuts

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