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 addon not working with Put? #225
Comments
Hey @yardenxr,
The progress addon only handles download progress.
As of today there is no easy way to handle progress with fetch unfortunately. For what it's worth, I think your middleware implementation is fine, I would just add a way to pass the content length from the outside instead of relying on the |
hey im using "wretch": "^2.8.0",
im trying to convert my axios call into wretch and im having a problem with the progress addon.
my axios call was:
and my wretch call looks like:
the file does get uploaded etc... but it never goes into the console log of the progress function.
i tried to do it with middlewares like this and it works but i dont think this is a good implementation it just was for testing purposes...
```
(next) => (url, opts) => {
// Custom middleware to handle progress
const totalSize = file.size
let loadedSize = 0
const abortController = new AbortController()
const signal = abortController.signal
// Attach progress event listener
file.stream().pipeTo(
new WritableStream({
write: (chunk) => {
loadedSize += chunk.length
onprogress?.(loadedSize, totalSize)
},
}),
{ signal }
)
return next(url, { ...opts, signal })
},
The text was updated successfully, but these errors were encountered: