Adds the ability to monitor progress when downloading a response.
Compatible with all platforms implementing the TransformStream WebAPI.
import ProgressAddon from "wretch/addons/progress"wretch("some_url") // Register the addon .addon(ProgressAddon()) .get() // Log the progress as a percentage of completion .progress((loaded, total) => console.log(`${(loaded / total * 100).toFixed(0)}%`)) Copy
import ProgressAddon from "wretch/addons/progress"wretch("some_url") // Register the addon .addon(ProgressAddon()) .get() // Log the progress as a percentage of completion .progress((loaded, total) => console.log(`${(loaded / total * 100).toFixed(0)}%`))
Adds the ability to monitor progress when downloading a response.
Compatible with all platforms implementing the TransformStream WebAPI.