Documentation ¶
Index ¶
- Constants
- Variables
- func FileExists(p string) (bool, error)
- func FindInParents(dir, filename string) (string, error)
- func IsDir(p string) (bool, error)
- func IsDirEmpty(name string) (bool, error)
- func PruneEmptyDirectories(dirPath string) ([]string, error)
- func RemoveFile(p string) error
- func VerifyAbsPath(absPath, basePath string) error
- func VerifyRelPath(relPath, basePath string) error
- func VerifySafeFilename(absPath string) error
- type RewindableReader
- type WriterThenReader
Constants ¶
View Source
const (
DefaultDirectoryMask = 0o755
)
Variables ¶
Functions ¶
func FileExists ¶ added in v0.106.0
func FindInParents ¶ added in v0.105.0
FindInParents Returns the first occurrence of filename going up the dir tree
func IsDirEmpty ¶ added in v0.106.0
func PruneEmptyDirectories ¶ added in v0.106.0
PruneEmptyDirectories iterates through the directory tree, removing empty directories, and directories that only contain empty directories.
func RemoveFile ¶ added in v0.106.0
func VerifyAbsPath ¶ added in v0.106.0
func VerifyRelPath ¶ added in v0.106.0
func VerifySafeFilename ¶ added in v0.106.0
VerifySafeFilename checks that the given file name is not a symbolic link and that the file name does not contain path traversal
Types ¶
type RewindableReader ¶
type RewindableReader interface { io.ReadSeeker // Rewind allows sets RewindableReader to start re-reading the same data. Rewind() error // Name returns a user-visible name for underlying storage. It may help debug some issues. Name() string }
RewindableReader allows repeatedly reading the same stream.
type WriterThenReader ¶
type WriterThenReader interface { io.Writer // StartReading stops writing and returns a RewindableReader that will allow repeatedly // reading the data and the total length of data. The WriterThenReader should be // discarded; calls to Write() after StartReading() will fail. StartReading() (RewindableReader, int64, error) // Name returns a user-visible name for underlying storage. It may help debug some issues. Name() string }
WriterThenReader writes data to storage, then allows reading it. It is suitable for repeatedly processing large volumes of data.
func NewFileWriterThenReader ¶
func NewFileWriterThenReader(basename string) (WriterThenReader, error)
Click to show internal directories.
Click to hide internal directories.