package filesystem // import "imuslab.com/arozos/mod/filesystem" FUNCTIONS func BufferedLargeFileCopy(src string, dst string, BUFFERSIZE int64) error Use for copying large file using buffering method. Allowing copying large file with little RAM func CheckMounted(mountpoint string) bool func DecodeURI(inputPath string) string func FileCopy(src string, dest string, mode string) error func FileMove(src string, dest string, mode string, fastMove bool) error func GetFileDisplaySize(filesize int64, rounding int) string func GetFileSize(filename string) int64 func GetMime(filepath string) (string, string, error) func GetModTime(filepath string) (int64, error) func IsDir(path string) bool func MatchingFileSystem(fsa *FileSystemHandler, fsb *FileSystemHandler) bool Check if the two file system are identical. func MountDevice(mountpt string, mountdev string, filesystem string) error func ViewZipFile(filepath string) ([]string, error) func ZipFile(filelist []string, outputfile string, includeTopLevelFolder bool) error TYPES type FileData struct { Filename string Filepath string Realpath string IsDir bool Filesize float64 Displaysize string } type FileProperties struct { VirtualPath string StoragePath string Basename string VirtualDirname string StorageDirname string Ext string MimeType string Filesize int64 Permission string LastModTime string LastModUnix int64 IsDirectory bool } type FileSystemHandler struct { Name string UUID string Path string Hierarchy string ReadOnly bool InitiationTime int64 FilesystemDatabase *db.Database Filesystem string } System Handler for returing func NewFileSystemHandler(option FileSystemOption) (*FileSystemHandler, error) Create a new file system handler with the given config func NewFileSystemHandlersFromJSON(jsonContent []byte) ([]*FileSystemHandler, error) Create a list of file system handler from the given json content func (fsh *FileSystemHandler) Close() func (fsh *FileSystemHandler) CreateFileRecord(realpath string, owner string) error Create a file ownership record func (fsh *FileSystemHandler) DeleteFileRecord(realpath string) error Delete a file ownership record func (fsh *FileSystemHandler) GetFileRecord(realpath string) (string, error) Read the owner of a file type FileSystemOption struct { Name string `json:"name"` //Display name of this device Uuid string `json:"uuid"` //UUID of this device, e.g. S1 Path string `json:"path"` //Path for the storage root Access string `json:"access,omitempty"` //Access right, allow {readonly, everyone, user:{username}, group:{groupname}} Hierarchy string `json:"hierarchy"` //Folder hierarchy, allow {public, user} Automount bool `json:"automount"` //Automount this device if exists Filesystem string `json:"filesystem,omitempty"` //Support {"ext4","ext2", "ext3", "fat", "vfat", "ntfs"} Mountdev string `json:"mountdev,omitempty"` //Device file (e.g. /dev/sda1) Mountpt string `json:"mountpt,omitempty"` //Device mount point (e.g. /media/storage1) Username string `json:"username,omitempty"` //Username if the storage require auth Password string `json:"password,omitempty"` //Password if the storage require auth } FileSystem configuration. Append more lines if required. type TrashedFile struct { Filename string Filepath string FileExt string IsDir bool Filesize int64 RemoveTimestamp int64 RemoveDate string OriginalPath string OriginalFilename string }