Documentation ¶
Index ¶
- type FileInfo
- type LocalStorage
- func (l *LocalStorage) AllDirectories(SubDirectoryPath string) (directoryPaths []string, err error)
- func (l *LocalStorage) AllFiles(DirectoryPath string) (files []FileInfo, err error)
- func (l *LocalStorage) Append(filePath string, content []byte) error
- func (l *LocalStorage) Copy(filePath string, destPath string) error
- func (l *LocalStorage) CopyAs(filePath string, destfolder string, newFilePath string) error
- func (l *LocalStorage) Create(filePath string, content []byte) error
- func (l *LocalStorage) Delete(filePath string) error
- func (l *LocalStorage) DeleteDirectory(DirectoryPath string) (err error)
- func (l *LocalStorage) DeleteMultiple(filePaths []string) (err error)
- func (l *LocalStorage) Directories(DirectoryPath string) (SubDirectoryPaths []string, err error)
- func (l *LocalStorage) Exists(filePath string) (bool, error)
- func (l *LocalStorage) FileInfo(filepath string) (fileinfo FileInfo, err error)
- func (l *LocalStorage) Files(DirectoryPath string) (files []FileInfo, err error)
- func (l *LocalStorage) MakeDirectory(DirectoryPath string, perm int) (err error)
- func (l *LocalStorage) Missing(filePath string) (bool, error)
- func (l *LocalStorage) Move(filePath string, destFolder string) error
- func (l *LocalStorage) MoveAs(filePath string, destFolder string, newFilePath string) error
- func (l *LocalStorage) Put(filePath string) error
- func (l *LocalStorage) PutAs(filePath string, filename string) error
- func (l *LocalStorage) Read(filePath string) ([]byte, error)
- func (l *LocalStorage) Rename(filePath string, newFilePath string) error
- func (l *LocalStorage) RenameDirectory(DirectoryPath string, NewDirectoryPath string) (err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileInfo ¶
type FileInfo struct { Name string NameWithoutExtension string LastModified time.Time Size int64 Extension string Path string IsDirectory bool FsFileInfo fs.FileInfo //golang's fs file info }
FileInfo provides file information
type LocalStorage ¶
type LocalStorage struct {
// contains filtered or unexported fields
}
LocalStorage local storage
func (*LocalStorage) AllDirectories ¶
func (l *LocalStorage) AllDirectories(SubDirectoryPath string) (directoryPaths []string, err error)
AllDirectories returns a list of directories including sub directories, it returns an error incase is any
func (*LocalStorage) AllFiles ¶
func (l *LocalStorage) AllFiles(DirectoryPath string) (files []FileInfo, err error)
AllFiles returns a list of files in the given directory including files in sub directories, the file type in the list is LocalStorage.FileInfo NOT the standard library fs.FileInfo
func (*LocalStorage) Append ¶
func (l *LocalStorage) Append(filePath string, content []byte) error
Append helps you append content to a file, it returns error incase there is any
func (*LocalStorage) Copy ¶
func (l *LocalStorage) Copy(filePath string, destPath string) error
Copy helps you copy files within the root folder, Please note that the reference of the paths of these files is the root folder, it accepts the source file starting from the root folder, and the destination folder starting from the root folder, it returns an error incase there is any
func (*LocalStorage) CopyAs ¶
func (l *LocalStorage) CopyAs(filePath string, destfolder string, newFilePath string) error
CopyAs helps you copy files within the root folder, Please note that the reference of the paths of these files is the root folder, it accepts the source file starting from the root folder and the destination folder starting from the root folder, and the new file name, it returns an error incase there is any
func (*LocalStorage) Create ¶
func (l *LocalStorage) Create(filePath string, content []byte) error
Create helps you create new a file and add content to it, it returns error incase there is any
func (*LocalStorage) Delete ¶
func (l *LocalStorage) Delete(filePath string) error
Delete deletes the given file it returns error incase there is any
func (*LocalStorage) DeleteDirectory ¶
func (l *LocalStorage) DeleteDirectory(DirectoryPath string) (err error)
DeleteDirectory deletes the given directory
func (*LocalStorage) DeleteMultiple ¶
func (l *LocalStorage) DeleteMultiple(filePaths []string) (err error)
DeleteMultiple deltes multiple files given as slice of strings of file paths, it returns error incase there is any
func (*LocalStorage) Directories ¶
func (l *LocalStorage) Directories(DirectoryPath string) (SubDirectoryPaths []string, err error)
Directories returns a slice of string containing the paths of the directories, if you want the list of directories including subdirectories, consider using the method "AllDirectories(DirectoryPath string)", it returns an error incase is any
func (*LocalStorage) Exists ¶
func (l *LocalStorage) Exists(filePath string) (bool, error)
Exists checks if a file exists withn the root folder, it returns a bool and an error incase any
func (*LocalStorage) FileInfo ¶
func (l *LocalStorage) FileInfo(filepath string) (fileinfo FileInfo, err error)
FileInfo returns information about the given file or an error incase there is any
func (*LocalStorage) Files ¶
func (l *LocalStorage) Files(DirectoryPath string) (files []FileInfo, err error)
Files returns a list of files in a given directory, the file type is LocalStorage.FileInfo
NOT the standard library fs.FileInfo,
and it returns an error incase any occurred, if you want a list of files including the files in sub directories, consider using the method `AllFiles(DirectoryPath string)`
func (*LocalStorage) MakeDirectory ¶
func (l *LocalStorage) MakeDirectory(DirectoryPath string, perm int) (err error)
MakeDirectory creates a new directory and the necessary parent directories with the given permissions, permissions could be (example: 0777) or any linux based permissions, it returns an error incase is any
func (*LocalStorage) Missing ¶
func (l *LocalStorage) Missing(filePath string) (bool, error)
Missing checks if a file is missing in the root folder, it returns a bool and an error incase any
func (*LocalStorage) Move ¶
func (l *LocalStorage) Move(filePath string, destFolder string) error
Move helps you Move files within the root folder, Please note that the of the paths of these files is the root folder, it accepts the source file starting from the root folder, and the destination folder starting from the root folder, it returns an error incase there any
func (*LocalStorage) MoveAs ¶
func (l *LocalStorage) MoveAs(filePath string, destFolder string, newFilePath string) error
MoveAs helps you Move files within the root folder, Please note that the reference of the paths of these files is the root folder, it accepts the source file starting from the root folder and the destination folder starting from the root folder, and the new file name, it returns an error incase there any
func (*LocalStorage) Put ¶
func (l *LocalStorage) Put(filePath string) error
Put helps you copy files into the root directory from external locations, filePath is the full path to the file you would like to put, it returns error incase there is any
func (*LocalStorage) PutAs ¶
func (l *LocalStorage) PutAs(filePath string, filename string) error
PutAs helps you copy files into the root directory from external directory, the first param 'filePath' is the full path to the file you would like to put, the second param 'fileName' is the name you would like to give to the file, it returns error incase there is any
func (*LocalStorage) Read ¶
func (l *LocalStorage) Read(filePath string) ([]byte, error)
Read helps you grap the content of a file, it returns the data in a slice of bytes and an error incase there is any
func (*LocalStorage) Rename ¶
func (l *LocalStorage) Rename(filePath string, newFilePath string) error
Rename renames the given file as first parameter to the name given as a second parameter, it returns error incase there is any
func (*LocalStorage) RenameDirectory ¶
func (l *LocalStorage) RenameDirectory(DirectoryPath string, NewDirectoryPath string) (err error)
RenameDirectory changes the name of directory to new name, it returns an error incase there is any