honojs/hono

Add support for getting current request progress in hono/client

Closed this issue · 4 comments

What is the feature you are proposing?

I would love to have a way to get the current progress of an ongoing request made through the hono client. This would allow monitoring and displaying the progress of requests, especially for large data transfers or long-running operations.

hc is fetch Response compatible, would existing libraries like fetch-progres, fetch-api-progress suit your needs?

I reckon using existing libraries like fetch-progres or fetch-api-progress might not quite fit the bill.

What I'm envisioning is for the hono client to support callbacks, maybe even custom ones. This way, I could track progress and handle it based on my own logic.

Just as an example, this is what I would code into my fetch function and then be able to use callbacks where I initially called a fetch via the hono client.

If this functionality already exists in some form or its not clear what I am proposing here, do let me know.

Edit: mistakenly had closed the issue..

Hi @davbauer

As @NamesMT said, the hc returns a Response object compatible with fetch so you can write the code with response.body.getReader() written in the document.

We designed hc as a thin wrapper of fetch. So, we don't want to add many functions to it.

I understand that it makes total sense to not over-implement already implemented stuff, I think the issue might be on my side, since I am using axios inside the fetch of the hono client initialization.

I will try to use native fetch and then test If I am able to get it working on my side and depending on that give feedback / close the issue.