file

package
v0.0.0-...-61cbdb0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2017 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package file handles various file operations

Package file handles various file operations

Index

Constants

View Source
const (
	LOG_PUBLIC_ERRORS  = "public_errors.log"
	LOG_ACCOUNT_ERRORS = "account_errors.log"
	LOG_SERVER_ERRORS  = "server/logs/server_errors.log"
	LOG_PUBLIC_LOAD    = "public_load_time.log"
)

Variables

This section is empty.

Functions

func CopyDir

func CopyDir(src string, dst string) error

CopyDir recursively copies a directory tree, attempting to preserve permissions. Source directory must exist, destination directory must *not* exist. Symlinks are ignored and skipped.

func CopyFile

func CopyFile(src, dst string) error

CopyFile copies the contents of the file named src to the file named by dst. The file will be created if it does not already exist. If the destination file exists, all it's contents will be replaced by the contents of the source file. The file mode will be copied from the source and the copied data is synced/flushed to stable storage.

Types

type Handler

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

func Open

func Open(file string, append bool) (*Handler, error)

Open function attempts to open a file and returns the handler for said file. This function takes a parameter append which if set to false will truncate the file upon writing to it. The log parameter denotes whether or not to look inside of the log folder when attempting to open a given file.

func (*Handler) Close

func (h *Handler) Close(delete bool) (error, error)

Close function is attached to the current file and will attempt to close the current file. The boolean parameter delete, if set to true, will also attempt to delete the file upon closing it.

func (*Handler) Read

func (h *Handler) Read() ([]byte, error)

Read function is attached to the file handler type and will read the current file.

func (*Handler) Write

func (h *Handler) Write(data string) (int, error)

Write function is attached to the file handler type and will write to the current file.

Jump to

Keyboard shortcuts

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