filesystem

package
v0.0.0-...-71c93ef Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InMemory

type InMemory struct {
	// contains filtered or unexported fields
}

func NewInMemory

func NewInMemory(spy *util.Spy) *InMemory

func (*InMemory) GetSpy

func (i *InMemory) GetSpy() *util.Spy

GetSpy returns the spy instance.

func (*InMemory) Read

func (i *InMemory) Read(_ context.Context, name string) ([]byte, error)

Read returns data previously written.

func (*InMemory) Write

func (i *InMemory) Write(_ context.Context, name string, data []byte) error

Write writes data to memory.

type Local

type Local struct {
	// contains filtered or unexported fields
}

Local can store and retrieve any file from a directory.

func NewLocal

func NewLocal(logger *log.Logger, rootPath string) *Local

NewLocal creates a new Local instance.

func (*Local) Read

func (l *Local) Read(_ context.Context, fileName string) ([]byte, error)

Read reads the file with the given name using the bucket path.

func (*Local) Write

func (l *Local) Write(_ context.Context, fileName string, data []byte) error

Write writes the given data to the file with the given name using the bucket path. Subdirectory creation is not supported.

type S3

type S3 struct {
	// contains filtered or unexported fields
}

S3 can store and retrieve any file from an S3 bucket.

func NewS3

func NewS3(client *s3.Client, logger *log.Logger, bucket string) *S3

NewS3 creates a new S3 instance.

func (*S3) Read

func (s *S3) Read(ctx context.Context, path string) ([]byte, error)

Read reads the file with the given name using the bucket path.

func (*S3) Write

func (s *S3) Write(ctx context.Context, path string, data []byte) error

Write writes the given data to the file with the given name using the bucket path. Subdirectory creation is not supported.

Jump to

Keyboard shortcuts

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