For the complete documentation index, see llms.txt. This page is also available as Markdown.

File.saveBase64

Functional API saveBase64DataYou can use the same feature with it as well.

Feature description

Saves Base64-encoded data to the user's device with the specified file name and MIME type. You can save various formats such as images, text, and PDFs. fileNamemust include an extension.

Toss app Android 5.218.0, iOS 5.216.0 It can be used on the above.

Type

File.saveBase64(params: SaveBase64DataParams): Promise<void>;

Params

type SaveBase64DataParams = {
  data: string;
  fileName: string;
  mimeType: string;
};

Response

There is no return value.

Example code

import { File } from "@apps-in-toss/web-framework";

async function handleSave() {
  try {
    await File.saveBase64({
      data: "iVBORw0KGgo...",
      fileName: "some-photo.png",
      mimeType: "image/png",
    });
  } catch (error) {
    console.error("Failed to save data:", error);
  }
}

document.querySelector("#save-file").addEventListener("click", handleSave);

Was this helpful?