Documentation
¶
Index ¶
- func CreateTestMemMapFs(t *testing.T, files map[string]string) afero.Fs
- func FileExists(ctx context.Context, key interface{}, filePath string) (bool, error)
- func NewTestMemMapFs() afero.Fs
- func OutputZip(ctx context.Context, key interface{}, w io.Writer) error
- func RuntimeFsFrom(ctx context.Context) afero.Fs
- func RuntimeFsOnto(ctx context.Context, runtimeFs afero.Fs) context.Context
- func SetDefaultFs(fs afero.Fs)
- func SourceFsFrom(ctx context.Context) afero.Fs
- func SourceFsOnto(ctx context.Context, sourceFs afero.Fs) context.Context
- func ToUnixPath(p string) string
- func WithZipFs(ctx context.Context, key interface{}) context.Context
- func ZipCreate(ctx context.Context, key interface{}, filePath string, content []byte) error
- func ZipEqualToFiles(t *testing.T, buf []byte, files map[string]string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateTestMemMapFs ¶ added in v0.161.0
CreateTestMemMapFs creates a memory fs from provided files. Keys are used as given (a bare relative key like "a.arrai" ends up rooted at "/a.arrai", same as an already-absolute "/a.arrai" would) — see NewTestMemMapFs.
func FileExists ¶ added in v0.161.0
FileExists checks if the provided file exists in the zip filesystem.
func NewTestMemMapFs ¶ added in v0.340.0
NewTestMemMapFs returns a fresh afero.MemMapFs made safe to address with either a bare relative path or a native absolute path (as filepath.Abs produces, including on Windows). Use this instead of afero.NewMemMapFs() for any test fixture that will be read through arrai's normal (non-bundling) file-resolution code.
func OutputZip ¶ added in v0.161.0
OutputZip outputs a zip file from all the files in the filesystem to the provided writer.
func RuntimeFsFrom ¶
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 ¶
RuntimeFsOnto returns a new Context with runtimeFs added to ctx.
func SetDefaultFs ¶
Sets the default Fs to be returned from SourceFsFrom and RuntimeFsFrom.
func SourceFsFrom ¶
SourceFsFrom extracts the filesystem used for import resolution from ctx.
func SourceFsOnto ¶
SourceFsOnto returns a new Context with sourceFs added to ctx.
func ToUnixPath ¶ added in v0.186.0
func WithZipFs ¶ added in v0.161.0
WithZipFs adds a filesystem that can be used to output a zip file.
Types ¶
This section is empty.