> For the complete documentation index, see [llms.txt](https://docs.win32.run/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.win32.run/developers/3rd-party-apps/save-file-as.md).

# Save File As

Save a file to win32.run through File Saving Dialog

```javascript
await win32.save_file_as(file, types)
```

### Params

#### file

`File`

Content of the file you want to save to win32. A File object. See [Mozilla Docs](https://developer.mozilla.org/en-US/docs/Web/API/File)

#### types

`[Object]`

win32.run allows users to save a file as different mimetypes. For example: text can be save as regular .txt plain text (text/plain) or .html webpage (text/html)

<pre class="language-javascript"><code class="lang-javascript"><strong>types = [
</strong>     {desc: 'Plain Text', mime: 'text/plain', ext: '.txt'},
     {desc: 'Webpage', mime: 'text/html', ext: '.html'}
]
</code></pre>

### Return

`Promise<String>`

Promise that resolves with id of the saved file, which can be used to retrieve the file later without invoking the Files Picker dialog.

### Example

```javascript
let text_content = '<h1>This is a heading of a webpage</h1>';
let file = new File([text_content], '_'); 
let types = [
     {desc: 'Plain Text', mime: 'text/plain', ext: '.txt'},
     {desc: 'Webpage', mime: 'text/html', ext: '.html'}
];
let id = await win32.save_file_as(file, types);
```

<figure><img src="/files/qO0o2ZYVkHM7bf8zl5M4" alt=""><figcaption></figcaption></figure>
