iohelpers

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package iohelpers contains functions for file I/O both locally and in GCS.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilesWithSuffix

func FilesWithSuffix(ctx context.Context, dir string, suffix string, cfg *IOConfig) ([]string, error)

FilesWithSuffix returns all file paths in a directory that end with a given suffix.

func ReadFile

func ReadFile(ctx context.Context, filePath string, cfg *IOConfig) ([]byte, error)

ReadFile reads the contents of a file at the given path. If the path is a GCS it will attempt to read the file from GCS.

func WriteFile

func WriteFile(ctx context.Context, filePath, fileName string, content []byte, cfg *IOConfig) error

WriteFile writes the given content to a file at the given path. If the path is a GCS it will attempt to write the file to GCS.

Types

type IOConfig

type IOConfig struct {
	GCSEndpoint string
}

IOConfig contains configuration options for IO functions.

Jump to

Keyboard shortcuts

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