fs

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2022 License: GPL-3.0 Imports: 6 Imported by: 403

Documentation

Overview

Package fs contains helper functions for file system access and enumeration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Chdir

func Chdir(path string, cb func() error) error

Chdir changes the process current working directory to the specified one, executes the callback and then restores the original working directory.

func Exists

func Exists(path string) bool

Exists returns true if the path exists.

func Expand

func Expand(path string) (string, error)

Expand will expand a path with ~ to the $HOME of the current user.

func Glob

func Glob(path string, expr string, cb func(fileName string) error) (err error)

Glob enumerates files on a given path using a globbing expression and execute a callback for each of the files. The callback can interrupt the loop by returning an error other than nil.

func LineReader

func LineReader(filename string) (chan string, error)

LineReader accepts the name of a file and offset as argument and will return a channel from which lines can be read one at a time.

Types

This section is empty.

Jump to

Keyboard shortcuts

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