util

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 14, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckHTTPResponse added in v0.1.2

func CheckHTTPResponse(resp *http.Response, err error) error

CheckHTTPResponse checks the http.Response pointer and error returned by the http.RoundTripper. Returns nil if there is no error and the status code of the response is 2xx.

func FileExists

func FileExists(filename string) bool

FileExists checks whether the given file path exists or not.

func GetHTMLPage added in v0.1.2

func GetHTMLPage(client *http.Client, url string) (*goquery.Document, error)

GetHTMLPage gets the HTML page of the given url and parses the document or returns and an error if the HTTP call or the parsing failed.

func HideFile

func HideFile(path string) (string, error)

HideFile hides the file at the given path. Might return another path with a leading . in the filename.

func IsHiddenFile

func IsHiddenFile(path string) (bool, error)

IsHiddenFile returns whether the given file path is a hidden file or not.

func IsHiddenFilePath

func IsHiddenFilePath(path string) bool

IsHiddenFilePath returns whether the given path could be a hidden file in the os.

func Unzip

func Unzip(src string, dest string) ([]string, error)

Unzip will decompress a zip archive, moving all files and folders within the zip file (parameter 1) to an output directory (parameter 2). from https://golangcode.com/unzip-files-in-go/

func WriteToHiddenFile

func WriteToHiddenFile(path string, data []byte, perm os.FileMode) error

WriteToHiddenFile writes the given data to a hidden file.

Types

This section is empty.

Directories

Path Synopsis
tests

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL