util

package
v0.33.9 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const IMAGEREGEX = `<img[^>]+src="([^">]+)"`

IMAGEREGEX to extract the image html tag

Variables

This section is empty.

Functions

func CurrentDir added in v0.10.1

func CurrentDir() (string, error)

CurrentDir returns the path where the executable is

func DirectoryOrFileDoesNotExist added in v0.17.0

func DirectoryOrFileDoesNotExist(filePath string) bool

DirectoryOrFileDoesNotExist check if a directory/file exist.

func GetPathToFile added in v0.30.0

func GetPathToFile(dir, name, issueNumber, format string, issueNumberOnly bool) string

GetPathToFile returns the path where the file should be saved.

func ImageType added in v0.5.0

func ImageType(mimeStr string) (tp string)

ImageType return the image type

func ImagesPathSetup added in v0.17.0

func ImagesPathSetup(createDefaultPath bool, outputFolder, source, name, issueNumber string) (string, error)

ImagesPathSetup creates the folders for the images to be saved. when `createDefaultPath` is false the images are stored without prepending the default folder path `comics/source/name/[comic.format]`.

func IsURLValid added in v0.6.1

func IsURLValid(url string) bool

IsURLValid exclude those url containing `.gif` and `logo`.

func IsValueInSlice

func IsValueInSlice(valueToCheck string, values []string) bool

IsValueInSlice checks if a value is already in a slice.

func Parse added in v0.12.3

func Parse(s string) string

Parse escapes characters

func PathSetup added in v0.6.1

func PathSetup(createDefaultPath bool, outputFolder, source, name string) (string, error)

PathSetup creates the folders where the comic will be saved. when `createDefaultPath` is false the comic is stored without prepending the default folder path `comics/source/name/[comic.format]`.

func SaveImage added in v0.17.0

func SaveImage(w io.Writer, content io.Reader, format string) error

SaveImage saves an image from a given format

func TrimAndSplitURL added in v0.10.1

func TrimAndSplitURL(u string) []string

TrimAndSplitURL trim tailing "/" and split url

func URLSource added in v0.6.1

func URLSource(u string) (string, error)

URLSource retrieves the hostname from given url.

Types

This section is empty.

Jump to

Keyboard shortcuts

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