fs

package module
v0.0.0-...-724f8e7 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2021 License: MIT Imports: 6 Imported by: 0

README

fs

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Copy

func Copy(ctx context.Context, dstURL, srcURL *url.URL) error

Copy copies a file from srcURL to dstURL.

func Create

func Create(ctx context.Context, dstURL *url.URL) (io.WriteCloser, error)

Create creates a file.

func NewProgressReader

func NewProgressReader(r io.Reader, f ProgressFunc) io.Reader

NewProgressReader creates a new io.Reader which reports progress.

func Open

func Open(ctx context.Context, srcURL *url.URL) (io.ReadCloser, error)

Open opens a file.

func Register

func Register(scheme string, constructor func() FileSystem)

Register registers a filesystem provider for the given scheme.

func WithProgressFunc

func WithProgressFunc(ctx context.Context, f ProgressFunc) context.Context

WithProgressFunc sets a progress function on a context.

Types

type FileInfo

type FileInfo = fs.FileInfo

FileInfo is used for info about a file.

func Stat

func Stat(ctx context.Context, srcURL *url.URL) (FileInfo, error)

Stat gets the file info for a file.

type FileSystem

type FileSystem interface {
	Create(ctx context.Context, dstURL *url.URL) (io.WriteCloser, error)
	Open(ctx context.Context, srcURL *url.URL) (io.ReadCloser, error)
	Stat(ctx context.Context, srcURL *url.URL) (FileInfo, error)
}

A FileSystem implements file operations.

type ProgressFunc

type ProgressFunc = func(add int)

A ProgressFunc is used to track progress of an operation.

func GetProgressFunc

func GetProgressFunc(ctx context.Context) ProgressFunc

GetProgressFunc gets a progress function from a context. If no function is defined a no-op function is returned.

Directories

Path Synopsis
cmd
fs
providers
os
Package os implements a filesystem using the operating system.
Package os implements a filesystem using the operating system.

Jump to

Keyboard shortcuts

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