Documentation
¶
Index ¶
- Constants
- Variables
- func CleanPathName(pathName string) string
- func DirPathExists(dirPath string) bool
- func FormatFileSize(fileSize int64) string
- func GetDefaultDownloadPath() string
- func GetFileSize(filePath string) (int64, error)
- func GetPostFolder(downloadPath, creatorName, postId, postTitle string) string
- func PathExists(filepath string) bool
- func ReadLine(reader *bufio.Reader) ([]byte, error)
- func RemoveExtFromFilename(filename string) string
- func SetDefaultDownloadPath(newDownloadPath string) error
- type ConfigFile
Constants ¶
const ( FILESIZE_TB = 1 << 40 FILESIZE_GB = 1 << 30 FILESIZE_MB = 1 << 20 FILESIZE_KB = 1 << 10 )
Variables ¶
var ( APP_PATH = getAppPath() DOWNLOAD_PATH = GetDefaultDownloadPath() )
Functions ¶
func CleanPathName ¶
Removes any illegal characters in a path name to prevent any error with file I/O using the path name
func DirPathExists ¶ added in v1.1.0
similar to PathExists but checks if the path exists and is a directory
func FormatFileSize ¶ added in v1.1.2
Returns a string representation of the estimated file size Note: uses bitwise operations to calculate the file size. Hence, the file size is an estimate.
func GetDefaultDownloadPath ¶
func GetDefaultDownloadPath() string
Returns the download path from the config file
func GetFileSize ¶
Returns the file size based on the provided file path
If the file does not exist or there was an error opening the file at the given file path string, -1 is returned
func GetPostFolder ¶
Returns a directory path for a post, artwork, etc. based on the user's saved download path and the provided arguments
func ReadLine ¶
Uses bufio.Reader to read a line from a file and returns it as a byte slice
Mostly thanks to https://devmarkpro.com/working-big-files-golang
func RemoveExtFromFilename ¶
Returns the path without the file extension
func SetDefaultDownloadPath ¶
Configure and saves the config file with updated download path