> ## Documentation Index
> Fetch the complete documentation index at: https://docs.startale.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Files and sharing

> Download files and open the native share sheet from your Mini App using standard web APIs.

The Startale App lets Mini Apps download files and use the native share sheet. Both use standard web APIs.

<Info>
  Both are available to Mini Apps in the production catalogue. In the [developer preview](/miniapps/testing#preview), file downloads work but `navigator.share()` does not. See [Iframe environment](/miniapps/capabilities/iframe-environment#preview-versus-catalogue).
</Info>

## Download a file

Create a Blob, point an anchor with the `download` attribute at it, and click it.

```ts theme={null}
function downloadCsv(rows: string[][], filename = 'payments.csv') {
  const csv = rows.map((r) => r.map((c) => `"${c.replaceAll('"', '""')}"`).join(',')).join('\n')
  const blob = new Blob([csv], { type: 'text/csv;charset=utf-8' })
  const url = URL.createObjectURL(blob)

  const a = document.createElement('a')
  a.href = url
  a.download = filename
  document.body.appendChild(a)
  a.click()
  a.remove()

  setTimeout(() => URL.revokeObjectURL(url), 0)
}
```

## Open the share sheet

Use `navigator.share()` to open the operating system share sheet.

```ts theme={null}
async function shareResult(url: string) {
  if (!navigator.share) return false

  try {
    await navigator.share({ title: 'My result', url })
    return true
  } catch (err) {
    // The user closing the sheet rejects with AbortError. That is not a failure.
    if (err instanceof DOMException && err.name === 'AbortError') return false
    throw err
  }
}
```

<Note>
  Call `navigator.share()` from a user gesture, such as a tap handler. Check that `navigator.share` exists before showing a share button.
</Note>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.