fs

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: May 28, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package fs provides a storage implementation for the local filesystem

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Enabled is a flag to enable or disable the storage
	Enabled bool `json:"enabled" koanf:"enabled" default:"false"`
	// Root is the root directory for the filesystem storage
	Root string `json:"root" koanf:"root" default:"./storage"`
}

Config is the configuration for Storage

type Storage

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

Storage is a local filesystem storage interface

func NewStorage

func NewStorage(cfg Config) *Storage

NewStorage returns a new filesystem storage with the provided configuration

func (*Storage) Delete

func (fs *Storage) Delete(ctx context.Context, path string) error

Delete deletes path

func (*Storage) Open

func (fs *Storage) Open(ctx context.Context, path string) (io.ReadCloser, error)

Open opens path for reading

func (*Storage) OpenWithStat

func (fs *Storage) OpenWithStat(ctx context.Context, path string) (io.ReadCloser, *storage.Stat, error)

OpenWithStat opens path for reading with file stats

func (*Storage) Save

func (fs *Storage) Save(ctx context.Context, content io.Reader, path string) error

Save saves content to the provided path

func (*Storage) Stat

func (fs *Storage) Stat(ctx context.Context, path string) (*storage.Stat, error)

Stat returns path metadata

Jump to

Keyboard shortcuts

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