Tauri — Save Files

Tauri has a save interface for saving files to the file system. Because of security, you will need to go through this route to handle downloading things that are inside the browser side. Like generating something on the canvas and then exporting it.

To save you can use the JS API save dialog from Tauri, and then write the file to the disk.

import { save } from "@tauri-apps/api/dialog";

const saveImage = async (dataUrl) => {
  const suggestedFilename = "image.png";

  // Save into the default downloads directory, like in the browser
  const filePath = await save({
    defaultPath: (await downloadsDir()) + "/" + suggestedFilename,

  // Now we can write the file to the disk
  await writeBinaryFile(file, await fetch(dataUrl).then((res) => res.blob()));

// then something like


Possibly there will be APIs that allow this to happen through the <a href="x" download="image.png"></a> browser interface in the future.