Skip to main content

download

Function download 

Source
pub fn download(
    file_name: &str,
    mime: &str,
    bytes: &[u8],
) -> Result<(), JsValue>
Expand description

Save bytes as file_name: wrap them in a Blob, mint an object URL, and click a detached <a download>, so the browser saves the file straight away rather than offering a link.

ยงErrors

If the document is gone, or the browser refuses the Blob or the URL.