Skip to content

Progress updates for download #1768

Closed
Closed
@machisuji

Description

@machisuji

Hi, I'm using sttp with ZIO to download quite large files via an API.
It looks something like this:

def downloadRequest(uri: Uri, fileName: String, apiKey: String) = basicRequest
    .auth.basic("apikey", apiToken)
    .get(uri)
    .response(asFile(new File(fileName)))

def download(): IO[Exception, File] =
  for
    backend <- HttpClientZioBackend()
    response <- downloadRequest(...).send(backend)
    file <- ZIO.fromEither(response.body).mapError(e => new Exception(s"Download failed: $e")))
  yield
    file

How would you go about getting updates about how far the download is?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions