fs

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Copyright 2023 Chainguard, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DirFSOption

type DirFSOption func(*dirFSOpts) error

DirFSOption is an option for DirFS

func DirFSWithCaseSensitive

func DirFSWithCaseSensitive(caseSensitive bool) DirFSOption

DirFSWithCaseSensitive allows you to specify whether the underlying filesystem should be treated as case-sensitive or insensitive. If you do not specify this, it determines it by testing the underlying filesystem. Normally you should let the filesystem determine this, but sometimes this can be useful.

func WithCreateDir

func WithCreateDir(createDir bool) DirFSOption

WithCreateDir allows you to specify whether the underlying directory should be created if it does not exist. Default is false.

type File

type File interface {
	fs.File
	io.WriteSeeker
	io.ReaderAt
}

File is an interface for a file. It includes Read, Write, Close. This wouldn't be necessary if os.File were an interface, or if fs.File were read/write.

type FullFS

type FullFS interface {
	Mkdir(path string, perm fs.FileMode) error
	MkdirAll(path string, perm fs.FileMode) error
	Open(name string) (fs.File, error)
	OpenReaderAt(name string) (File, error)
	OpenFile(name string, flag int, perm fs.FileMode) (File, error)
	ReadFile(name string) ([]byte, error)
	WriteFile(name string, b []byte, mode fs.FileMode) error
	ReadDir(name string) ([]fs.DirEntry, error)
	Mknod(path string, mode uint32, dev int) error
	Readnod(name string) (dev int, err error)
	Symlink(oldname, newname string) error
	Link(oldname, newname string) error
	Readlink(name string) (target string, symlink bool, err error)
	Stat(path string) (fs.FileInfo, error)
	Lstat(path string) (fs.FileInfo, error)
	Create(name string) (File, error)
	Remove(name string) error
	Chmod(path string, perm fs.FileMode) error
	Chown(path string, uid int, gid int) error
}

FullFS is a filesystem that supports all filesystem operations.

func DirFS

func DirFS(dir string, opts ...DirFSOption) FullFS

func NewMemFS

func NewMemFS() FullFS

type OpenReaderAtFS

type OpenReaderAtFS interface {
	fs.FS
	OpenReaderAt(name string) (File, error)
}

type OpenReaderAtReadLinkFS

type OpenReaderAtReadLinkFS interface {
	OpenReaderAtFS
	ReadLinkFS
}

type OpenReaderAtReadLinkReadnodFS

type OpenReaderAtReadLinkReadnodFS interface {
	OpenReaderAtFS
	ReadLinkFS
	ReadnodFS
}

type ReadLinkFS

type ReadLinkFS interface {
	fs.FS
	Readlink(name string) (string, bool, error)
}

type ReadnodFS

type ReadnodFS interface {
	fs.FS
	Readnod(name string) (dev int, err error)
}

Jump to

Keyboard shortcuts

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