Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Progress updates for download #1768

Open
machisuji opened this issue Mar 14, 2023 · 0 comments
Open

Progress updates for download #1768

machisuji opened this issue Mar 14, 2023 · 0 comments

Comments

@machisuji
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant