mirror of
https://github.com/supabase/supabase.git
synced 2026-07-04 14:34:21 +08:00
81 lines
2.0 KiB
Plaintext
81 lines
2.0 KiB
Plaintext
---
|
|
id: storage-from-createsignedurls
|
|
title: 'from.createSignedUrls()'
|
|
slug: /storage-from-createsignedurls
|
|
custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml
|
|
---
|
|
|
|
import Tabs from '@theme/Tabs'
|
|
import TabItem from '@theme/TabItem'
|
|
|
|
Creates multiple signed URLs. Use a signed URL to share a file for a fixed amount of time.
|
|
|
|
```js
|
|
const { data, error } = await supabase.storage
|
|
.from('avatars')
|
|
.createSignedUrls(['folder/avatar1.png', 'folder/avatar2.png'], 60)
|
|
```
|
|
|
|
## Parameters
|
|
|
|
<ul className="method-list-group">
|
|
|
|
<li className="method-list-item">
|
|
<h4 className="method-list-item-label">
|
|
<span className="method-list-item-label-name">
|
|
paths
|
|
</span>
|
|
<span className="method-list-item-label-badge required">
|
|
required
|
|
</span>
|
|
<span className="method-list-item-validation">
|
|
<code>object</code>
|
|
</span>
|
|
</h4>
|
|
<div class="method-list-item-description">
|
|
|
|
The file paths to be downloaded, including the current file names. For example `['folder/image.png', 'folder2/image2.png']`.
|
|
|
|
</div>
|
|
|
|
</li>
|
|
|
|
<li className="method-list-item">
|
|
<h4 className="method-list-item-label">
|
|
<span className="method-list-item-label-name">
|
|
expiresIn
|
|
</span>
|
|
<span className="method-list-item-label-badge required">
|
|
required
|
|
</span>
|
|
<span className="method-list-item-validation">
|
|
<code>number</code>
|
|
</span>
|
|
</h4>
|
|
<div class="method-list-item-description">
|
|
|
|
The number of seconds until the signed URLs expire. For example, `60` for URLs which are valid for one minute.
|
|
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
## Notes
|
|
|
|
- RLS policy permissions required:
|
|
- `buckets` table permissions: none
|
|
- `objects` table permissions: `select`
|
|
- Refer to the [Storage guide](/docs/guides/storage#access-control) on how access control works
|
|
|
|
## Examples
|
|
|
|
### Create Signed URLs
|
|
|
|
```js
|
|
const { data, error } = await supabase.storage
|
|
.from('avatars')
|
|
.createSignedUrls(['folder/avatar1.png', 'folder/avatar2.png'], 60)
|
|
```
|