Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateFile ¶
CreateFile creates a file on the given filepath along with any necessary parents, and returns nil, or else returns an error.
Example ¶
err := CreateFile(existingFile) if err != nil { fmt.Println("Failed to create file because it already exists") } else { fmt.Println("File has been created successfully!") }
Output: Failed to create file because it already exists
func FileExists ¶
FileExists reports whether the provided file exists.
Example ¶
exists := FileExists("/missing-file.txt") if exists { fmt.Println("File exists") } else { fmt.Println("File does not exist") }
Output: File does not exist
func FolderExists ¶
FolderExists reports whether the provided directory exists.
Example ¶
exists := FolderExists("/a-non-existing-folder") if exists { fmt.Println("Folder exists") } else { fmt.Println("Folder does not exist") }
Output: Folder does not exist
func IsOnline ¶
IsOnline checks the provided URL for connectivity
Example ¶
google, _ := url.Parse("https://google.com") err := IsOnline(*google) if err != nil { fmt.Println("Host is not accessible") } else { fmt.Println("Host is accessible") }
Output: Host is accessible
func IsValidUrl ¶
IsValidUrl tests a string to determine if it is a well-structured url or not.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.