# 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>


---

# Agent Instructions: 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:

```
GET https://docs.win32.run/developers/3rd-party-apps/save-file-as.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
