fetch

suspend fun fetch(url: URL): ByteArrayInputStream

Makes a GET request to the given URL and returns the response body in a ByteArrayInputStream.

Return

A ByteArrayInputStream containing the response body.

Parameters

url

The URL to which the request is made.

Throws

If an error (e.g. network error) occurs while downloading the file. This is an instance of UnexpectedResponseException if the status code of the response isn't 2xx or the response is missing a body.


suspend fun fetch(url: URL, file: File)

Downloads a file from the given URL into the given file.

Throws

If an error (e.g. network error) occurs while downloading the file. This is an instance of [ ] if the status code of the response isn't 2xx or the response is missing a body.