🎨 Code improvement(s)
- Add progress option to customize the upload body size computation (2cd547f)
import ProgressAddon from "wretch/addons/progress"
wretch("https://example.com/upload")
.addon(ProgressAddon({
// getUploadTotal allows you to customize the total size of the upload
getUploadTotal(url, opts) {
// Return the total size of the upload in bytes, or 0 if undetermined
},
}))
.get()
.progress((loaded, total) => console.log(`${(loaded / total * 100).toFixed(0)}%`))