file

package
v0.14.2 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package file implements utilities to read files from various backends.

Package file implements utilities to read files from various backends.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ModTime

func ModTime(ctx context.Context, fname string) (time.Time, error)

ModTime returns file's modified timestamp.

func ReadFile

func ReadFile(ctx context.Context, fname string, readOptions ...ReadOption) ([]byte, error)

ReadFile returns file contents as a slice of bytes. It's similar to ioutil's ReadFile, but includes support for files on non-disk locations. For example, files with paths starting with gs:// are assumed to be on GCS, and are read from GCS.

func ReadWithCache

func ReadWithCache(ctx context.Context, fname string, refreshInterval time.Duration, readOptions ...ReadOption) ([]byte, error)

Types

type ReadOption added in v0.14.0

type ReadOption func(*readFileOpts)

func WithEnvSubstitution added in v0.14.0

func WithEnvSubstitution() ReadOption

Jump to

Keyboard shortcuts

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