ctxfs

package
v0.319.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2023 License: Apache-2.0 Imports: 15 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTestMemMapFs added in v0.161.0

func CreateTestMemMapFs(t *testing.T, files map[string]string) afero.Fs

CreateTestMemMapFs creates a memory fs from provided files

func FileExists added in v0.161.0

func FileExists(ctx context.Context, key interface{}, filePath string) (bool, error)

FileExists checks if the provided file exists in the zip filesystem.

func OutputZip added in v0.161.0

func OutputZip(ctx context.Context, key interface{}, w io.Writer) error

OutputZip outputs a zip file from all the files in the filesystem to the provided writer.

func RuntimeFsFrom

func RuntimeFsFrom(ctx context.Context) afero.Fs

RuntimeFsFrom extracts the filesystem used to access the filesystem from ctx. It will be used by //os.file and similar functions. TODO: Actually use it.

func RuntimeFsOnto

func RuntimeFsOnto(ctx context.Context, runtimeFs afero.Fs) context.Context

RuntimeFsOnto returns a new Context with runtimeFs added to ctx.

func SetDefaultFs

func SetDefaultFs(fs afero.Fs)

Sets the default Fs to be returned from SourceFsFrom and RuntimeFsFrom.

func SourceFsFrom

func SourceFsFrom(ctx context.Context) afero.Fs

SourceFsFrom extracts the filesystem used for import resolution from ctx.

func SourceFsOnto

func SourceFsOnto(ctx context.Context, sourceFs afero.Fs) context.Context

SourceFsOnto returns a new Context with sourceFs added to ctx.

func ToUnixPath added in v0.186.0

func ToUnixPath(p string) string

func WithZipFs added in v0.161.0

func WithZipFs(ctx context.Context, key interface{}) context.Context

WithZipFs adds a filesystem that can be used to output a zip file.

func ZipCreate added in v0.161.0

func ZipCreate(ctx context.Context, key interface{}, filePath string, content []byte) error

ZipCreate creates a file with the provided filepath and content. The filepath has to be in UNIX path format.

func ZipEqualToFiles added in v0.161.0

func ZipEqualToFiles(t *testing.T, buf []byte, files map[string]string)

ZipEqualToFiles is a test utility that compares a zip buffer to a map of files, whose keys are filepaths and values are content of the files.

Types

This section is empty.

Jump to

Keyboard shortcuts

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