file

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package file helps with file handling.

Index

Constants

This section is empty.

Variables

View Source
var ReadLines = BigReadLines

ReadLines reads all lines of a file into lines.

Functions

func BigReadLines

func BigReadLines(file string) ([]string, error)

BigReadLines reads all lines of a file into lines. https://stackoverflow.com/questions/7424340/read-in-lines-in-a-text-file-sort-then-overwrite-file

func Copy

func Copy(src, dst string) (err error)

Copy 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.

func CopyDir

func CopyDir(src string, dst string) (err 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 Random

func Random(s, dir, pattern string) string

Random creates a random file containing s and returns its name. See ioutil.Tempfile() for dir and pattern.

func ReadString

func ReadString(filename string) (s string)

ReadString returns filename content as string

func WriteLines

func WriteLines(file string, lines []string) error

WriteLines writes string slice containing lines to file

Types

This section is empty.

Jump to

Keyboard shortcuts

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