Documentation ¶
Overview ¶
Package fileutils implements some useful functions to work with the file system.
Index ¶
- func CleanPath(p string) (string, error)
- func CopyDir(source string, dest string, uid, gid int) error
- func CopyFile(source string, dest string, uid, gid int) error
- func Exists(path string) bool
- func GenPreviewConvertPath(path string, scope string, previewScope string) (outp string, err error)
- func GetBasedOnExtensions(name string) (res bool, t string)
- func GetFileInfo(scope, urlPath string) (info os.FileInfo, err error, path string)
- func ModPermission(uid, gid int, path string) (err error)
- func PreviewPathMod(orig, scope, pScope string) (p string)
- func ReplacePrevExt(srcPath string) (path string, t string)
- func SlashClean(name string) string
- type Dir
- func (d Dir) Copy(src, dst string, uid, gid int) error
- func (d Dir) Mkdir(name string, perm os.FileMode, uid, gid int) error
- func (d Dir) OpenFile(name string, flag int, perm os.FileMode, uid, gid int) (*os.File, error)
- func (d Dir) RemoveAll(name string) error
- func (d Dir) Rename(oldName, newName string) error
- func (d Dir) Stat(name string) (os.FileInfo, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopyDir ¶
CopyDir copies a directory from source to dest and all of its sub-directories. It doesn't stop if it finds an error during the copy. Returns an error if any.
func GenPreviewConvertPath ¶
Will return input and output to be processed to the bash convert/ffmpeg in order to generate preview
func GetBasedOnExtensions ¶
getBasedOnExtensions checks if a file can be edited by its mimeExt.
func GetFileInfo ¶
should get information about file.
func ModPermission ¶
func PreviewPathMod ¶
func ReplacePrevExt ¶
modify existing file extension to the preview
func SlashClean ¶
SlashClean is equivalent to but slightly more efficient than path.Clean("/" + name).
Types ¶
type Dir ¶
type Dir string
A Dir uses the native file system restricted to a specific directory tree. Originally from ttps://github.com/golang/net/blob/master/webdav/file.go An empty Dir is treated as ".".
func (Dir) Copy ¶
Copy copies a file or directory from src to dst. If it is a directory, all of the files and sub-directories will be copied.