> 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).

# Save file

### Saving files

**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. It can save data in various formats such as images, text, and PDF.

**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 should include the extension as well. 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
