fileutils

package
v0.8.4 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package fileutils implements some useful functions to work with the file system.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanPath added in v0.8.3

func CleanPath(p string) (string, error)

just in case

func CopyDir

func CopyDir(source string, dest string, uid, gid int) error

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 CopyFile

func CopyFile(source string, dest string, uid, gid int) error

CopyFile copies a file from source to dest and returns an error if any.

func Exists

func Exists(path string) bool

func GenPreviewConvertPath

func GenPreviewConvertPath(path string, scope string, previewScope string) (outp string, err error)

Will return input and output to be processed to the bash convert/ffmpeg in order to generate preview

func GetBasedOnExtensions

func GetBasedOnExtensions(name string) (res bool, t string)

getBasedOnExtensions checks if a file can be edited by its mimeExt.

func GetFileInfo

func GetFileInfo(scope, urlPath string) (info os.FileInfo, err error, path string)

should get information about file.

func ModPermission

func ModPermission(uid, gid int, path string) (err error)

func PreviewPathMod

func PreviewPathMod(orig, scope, pScope string) (p string)

func ReplacePrevExt

func ReplacePrevExt(srcPath string) (path string, t string)

modify existing file extension to the preview

func SlashClean

func SlashClean(name string) string

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

func (d Dir) Copy(src, dst string, uid, gid int) error

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.

func (Dir) Mkdir

func (d Dir) Mkdir(name string, perm os.FileMode, uid, gid int) error

Mkdir implements os.Mkdir in this directory context.

func (Dir) OpenFile

func (d Dir) OpenFile(name string, flag int, perm os.FileMode, uid, gid int) (*os.File, error)

OpenFile implements os.OpenFile in this directory context.

func (Dir) RemoveAll

func (d Dir) RemoveAll(name string) error

RemoveAll implements os.RemoveAll in this directory context.

func (Dir) Rename

func (d Dir) Rename(oldName, newName string) error

Rename implements os.Rename in this directory context.

func (Dir) Stat

func (d Dir) Stat(name string) (os.FileInfo, error)

Stat implements os.Stat in this directory context.

Jump to

Keyboard shortcuts

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