fileoperation

package
v2.0.0-...-eb6a9d5 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package fileoperation provides a set of functions commonly used on files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendLines

func AppendLines(lines []string, filename string) error

AppendLines appends all lines to a text file, creating a new file if it doesn't exist.

func AppendWord

func AppendWord(src string, dest string, sep string, word string) error

AppendWord appends a separator and a word to each lines present in a text file.

func Cat

func Cat(filenames []string, w io.Writer) error

Cat reads files sequentially and sends the output to the specified writer.

func CatIO

func CatIO(readers []io.Reader, w io.Writer) error

CatIO reads sequentially from readers and sends the output to the specified writer.

func Copy

func Copy(src string, dest string) error

Copy copies a file from the source filename to the destination filename.

func CountLines

func CountLines(filename string) (int, error)

CountLines counts the number of lines in a file.

func FileExists

func FileExists(path string) bool

FileExists returns true if a file exists on disk.

func ReadLines

func ReadLines(filename string) ([]string, error)

ReadLines read lines from a text file and returns them as a slice.

func WriteLines

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

WriteLines writes all lines to a text file, truncating the file if it already exists.

Types

This section is empty.

Jump to

Keyboard shortcuts

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