# saveFile (deprecated)

{% hint style="danger" %}
**`saveFile()` is considered deprecated**

Support for the `saveFile()` may be dropped in future versions of the JourneyApps Runtime. Please upgrade your app to use [`journey.files.saveFile`](https://docs.journeyapps.com/reference/build/js-ts-apis/journey/journey.files#journey.files.savefile) to ensure that your app remains compatible with the JourneyApps Runtime.
{% endhint %}

{% hint style="info" %}
**Version and platform compatibility**

`saveFile` was introduced in version **4.25.0** of the JourneyApps Container.

Due to limitations on mobile file systems, this method only works on Desktop platforms.
{% endhint %}

### Format

```javascript
saveFile(data, filename);
```

| Parameter             | Details                                           |
| --------------------- | ------------------------------------------------- |
| `data` (Required)     | The `string` or `ArrayBuffer` to save to the file |
| `filename` (Required) | The name of the file that will be created         |

### Examples

Saving a string:

```javascript
var text = "Text to save!";
saveFile(text, 'my-file.txt');
```

Saving an image:

```javascript
var buffer = view.myImage.toArrayBuffer();
saveFile(buffer, 'my-image.jpg');
```
