# Pick Files

Let the user pick files through win32.run Files Picker dialog.

```javascript
await win32.pick_files(desc, exts, multiple);
```

### Params

#### desc

`String`

Description of the files you want to pick. It will be displayed to the user.

```javascript
let desc = 'Whatever, any files';
```

#### exts

`[String]`

Acceptable file extensions, case-insensitive. Each extension starts with a dot character.

```javascript
let exts = ['.txt', '.html', '.md'];
```

Specify an empty array \[] to accept any extension

#### multiple

`Boolean`

Default to `true`

Whether to allow the user to select multiple or single file.

### Returns

`Promise<[Object]>`

A promise that resolves with an array of objects. Each object has the following structure.

```javascript
{
    id: String, 
    //id of the file on win32.run
    //which can be used to retrieve the file later 
    //without invoking the Files Picker dialog. See Get File section

    win32_name: String, 
    //display name of the file on win32.run. 
    //could be different to name in file.name

    win32_path: String, 
    //path of the file on win32.run. 
    //it just for display purpose (like in My Computer). 
    //GET request to win32_path will not return the file content

    file: File
    //a File object, 
    //see https://developer.mozilla.org/en-US/docs/Web/API/File
}
```

This method will always return a promise of an array, regardless of the `multiple` value

### Example

```javascript
let results = await win32.pick_files('Any plain text files', ['.txt', '.html', '.md'], true);

//read text content of the first file using File.text()
let content = await results[0].file.text();
```

<figure><img src="/files/8bxrBRJJE7CSeXCj3qrJ" 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/pick-files.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.
