memfs

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

README

memfs

https://github.com/go-git/go-billy/tree/master/memfs but support custom Storage

The package is developing now. And it will merge into github.com/go-git/go-billy/v5/memfs if possible

Documentation

Overview

Package memfs provides a billy filesystem base on memory.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() billy.Filesystem

New returns a new Memory filesystem.

func NewWithStorage

func NewWithStorage(storage Storage) billy.Filesystem

NewWithStorage returns a new Memory filesystem use custom storage backend

Types

type ByName

type ByName []os.FileInfo

func (ByName) Len

func (a ByName) Len() int

func (ByName) Less

func (a ByName) Less(i, j int) bool

func (ByName) Swap

func (a ByName) Swap(i, j int)

type FileInfo

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

func (*FileInfo) IsDir

func (fi *FileInfo) IsDir() bool

func (*FileInfo) ModTime

func (*FileInfo) ModTime() time.Time

func (*FileInfo) Mode

func (fi *FileInfo) Mode() os.FileMode

func (*FileInfo) Name

func (fi *FileInfo) Name() string

func (*FileInfo) Size

func (fi *FileInfo) Size() int64

func (*FileInfo) Sys

func (*FileInfo) Sys() interface{}

type Memory

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

Memory a very convenient filesystem based on memory files

func (*Memory) Capabilities

func (fs *Memory) Capabilities() billy.Capability

Capabilities implements the Capable interface.

func (*Memory) Create

func (fs *Memory) Create(filename string) (billy.File, error)

func (*Memory) Join

func (fs *Memory) Join(elem ...string) string

func (*Memory) Lstat

func (fs *Memory) Lstat(filename string) (os.FileInfo, error)

func (*Memory) MkdirAll

func (fs *Memory) MkdirAll(path string, perm os.FileMode) error

func (*Memory) Open

func (fs *Memory) Open(filename string) (billy.File, error)

func (*Memory) OpenFile

func (fs *Memory) OpenFile(filename string, flag int, perm os.FileMode) (billy.File, error)

func (*Memory) ReadDir

func (fs *Memory) ReadDir(path string) ([]os.FileInfo, error)
func (fs *Memory) Readlink(link string) (string, error)

func (*Memory) Remove

func (fs *Memory) Remove(filename string) error

func (*Memory) Rename

func (fs *Memory) Rename(from, to string) error

func (*Memory) Stat

func (fs *Memory) Stat(filename string) (os.FileInfo, error)
func (fs *Memory) Symlink(target, link string) error

func (*Memory) TempFile

func (fs *Memory) TempFile(dir, prefix string) (billy.File, error)

type Storage

type Storage interface {
	Has(path string) bool
	Get(path string) (billy.File, bool)
	New(path string, mode os.FileMode, flag int) (billy.File, error)
	Children(path string) []billy.File
	Rename(from, to string) error
	Remove(path string) error
}

func NewMemoryStorage

func NewMemoryStorage() Storage

Jump to

Keyboard shortcuts

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