file

package
v0.0.0-...-100cc6e Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: Apache-2.0 Imports: 9 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsBytes

func AsBytes(filename string) ([]byte, error)

AsBytes is a simple wrapper around os.ReadFile provided for completeness.

func AsBytesOrFail

func AsBytesOrFail(t test.Failer, filename string) []byte

AsBytesOrFail calls AsBytes and fails the test if any errors occurred.

func AsString

func AsString(filename string) (string, error)

AsString is a convenience wrapper around os.ReadFile that converts the content to a string.

func AsStringArray

func AsStringArray(files ...string) ([]string, error)

AsStringArray is a convenience wrapper around os.ReadFile that converts the content to a string.

func AsStringArrayOrFail

func AsStringArrayOrFail(t test.Failer, files ...string) []string

AsStringArrayOrFail calls AsStringOrFail and then converts to string.

func AsStringOrFail

func AsStringOrFail(t test.Failer, filename string) string

AsStringOrFail calls AsBytesOrFail and then converts to string.

func MustAsBytes

func MustAsBytes(filename string) []byte

MustAsBytes calls AsBytes and panics the test if any errors occurred.

func MustAsString

func MustAsString(filename string) string

MustAsString calls MustAsBytes and then converts to string.

func NormalizePath

func NormalizePath(originalPath string) (string, error)

NormalizePath expands the homedir (~) and returns an error if the file doesn't exist.

func ReadDir

func ReadDir(filePath string, extensions ...string) ([]string, error)

ReadDir returns the names of all files in the given directory. This is not recursive. The base path is appended; for example, ReadDir("dir") -> ["dir/file1", "dir/folder1"]

func ReadDirOrFail

func ReadDirOrFail(t test.Failer, filePath string, extensions ...string) []string

func ReadTarFile

func ReadTarFile(filePath string) (string, error)

ReadTarFile reads a tar compress file from the embedded

func WriteOrFail

func WriteOrFail(t test.Failer, filePath string, contents []byte)

Types

This section is empty.

Jump to

Keyboard shortcuts

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