imgdl

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Pakage imgdl provides functions to download one or multiple image asynchronousely.

Index

Constants

View Source
const (
	// This constant specifies timeout (in second) downloading one image.
	TIMEOUT_SEC = 30
)

Variables

This section is empty.

Functions

func DownloadImagesZip

func DownloadImagesZip(urls []string, path, prefix string) error

DownloadImagesZip asychronously donwloads multiple images at once and write to a zip file. This function will spawn a go routine for each url so caller must ensure not too many runs at a time since it can lead to network error.

func DownloadImgage

func DownloadImgage(url string, path string) error

DownloadImgage downloads a single image and save to path. Unexist parent folder will be created and image extension is guess from MIME type.

func DownloadImgages

func DownloadImgages(urls []string, prefix string) error

DownloadImages asychronously donwloads multiple images at once and write to a folder.

func GetImageData

func GetImageData(url string) (string, *io.ReadCloser, error)

GetImageData downloads a single image, returns its extension and a ReadCloser which holds image data.

Types

This section is empty.

Jump to

Keyboard shortcuts

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