tiktok-dl/utils/fileio.go

22 lines
389 B
Go
Raw Normal View History

2020-01-19 02:11:53 +00:00
package utils
import (
"os"
)
// CheckIfExists - Checks if file or directory exists
func CheckIfExists(path string) bool {
if _, err := os.Stat(path); os.IsNotExist(err) {
return false
}
return true
}
// InitOutputDirectory - Creates output directory
func InitOutputDirectory(path string) {
if _, err := os.Stat(path); os.IsNotExist(err) {
os.MkdirAll(path, os.ModePerm)
}
}