downloadImage

Downloads an image from the prnt.sc (prntscr.com) server.

int
downloadImage
(
ref Appender!(ubyte[]) buffer
,
const string url
,
const string imagePath
,
const Duration requestTimeout
,
const string[string] headers
,
const bool alwaysKeep
)

Parameters

buffer Appender!(ubyte[])

Appender to save the downloaded image to.

url string

HTTP URL to fetch.

imagePath string

Filename to save the downloaded image to.

requestTimeout Duration

Timeout to use when downloading.

headers string[string]

HTTP GET headers to supply when downloading.

alwaysKeep bool

Whether or not to always keep downloaded files, even if they're not valid images.

Return Value

Type: int

The HTTP code encountered when attempting to download the image. The magic number MagicNumber.fileIsNotAnImage is returned if the downloaded file was detected as not an image.

Meta