> For the complete documentation index, see [llms.txt](https://developers-apps-in-toss.toss.im/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers-apps-in-toss.toss.im/documentation/api-and-sdk-en/common/file-storage/file.md). Agents can also search and read this documentation through its [MCP server](https://developers-apps-in-toss.toss.im/~gitbook/mcp).

# File saving

### Save File

**SDK function:** `saveBase64Data`

`saveBase64Data` This function saves Base64 data encoded as a string to the user's device with the specified file name and MIME type. You can save data in various formats such as images, text, and PDFs.

**Signature**

```typescript
function saveBase64Data(params: SaveBase64DataParams): Promise<void>;
```

**Parameters**

* **params** · Required · `SaveBase64DataParams`

  An object containing the data to save and file information.

  * **params.data** · Required · `string`

    A Base64-encoded data string.
  * **params.fileName** · Required · `string`

    The name of the file to save. You must include the extension too. For example, you can save it as 'example.png'.
  * **params.mimeType** · Required · `string`

    The MIME type of the file to save. For example, specifying 'image/png' means an image, and 'application/pdf' means a PDF file. For more details, see [MIME documentation](https://developer.mozilla.org/ko/docs/Web/HTTP/Guides/MIME_types).

**Example**

**Saving Base64 image data to the user's device**

{% tabs %}
{% tab title="js" %}

```js
import { saveBase64Data } from '@apps-in-toss/web-framework';

async function handleSaveBase64Data() {
  try {
    await saveBase64Data({
      data: 'iVBORw0KGgo...',
      fileName: 'some-photo.png',
      mimeType: 'image/png',
    });
    console.log('Data saved successfully');
  } catch (error) {
    console.error('Failed to save data:', error);
  }
}
```

{% endtab %}

{% tab title="React" %}

```tsx
import { saveBase64Data } from '@apps-in-toss/web-framework';
import { Button } from '@toss/tds-mobile';

function SaveButton() {
  const handleSave = async () => {
    try {
      await saveBase64Data({
        data: 'iVBORw0KGgo...',
        fileName: 'some-photo.png',
        mimeType: 'image/png',
      });
    } catch (error) {
      console.error('Failed to save data:', error);
    }
  };

  return <Button onClick={handleSave}>Save</Button>;
}
```

{% endtab %}

{% tab title="React Native" %}

```tsx
import { saveBase64Data } from '@apps-in-toss/framework';
import { Button } from '@toss/tds-react-native';

function SaveButton() {
  const handleSave = async () => {
    try {
      await saveBase64Data({
        data: 'iVBORw0KGgo...',
        fileName: 'some-photo.png',
        mimeType: 'image/png',
      });
    } catch (error) {
      console.error('Failed to save data:', error);
    }
  };

  return <Button onPress={handleSave}>Save</Button>;
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://developers-apps-in-toss.toss.im/documentation/api-and-sdk-en/common/file-storage/file.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
