Files
supabase/apps/reference/_supabase_js/generated/storage-updatebucket.mdx
2022-08-23 13:05:23 +08:00

106 lines
2.3 KiB
Plaintext

---
id: storage-updatebucket
title: 'updateBucket()'
slug: /storage-updatebucket
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'
Updates a Storage bucket
```js
const { data, error } = await supabase.storage.updateBucket('avatars', {
public: false,
})
```
## Parameters
<ul className="method-list-group">
<li className="method-list-item">
<h4 className="method-list-item-label">
<span className="method-list-item-label-name">
id
</span>
<span className="method-list-item-label-badge required">
required
</span>
<span className="method-list-item-validation">
<code>string</code>
</span>
</h4>
<div class="method-list-item-description">
A unique identifier for the bucket you are updating.
</div>
</li>
<li className="method-list-item">
<h4 className="method-list-item-label">
<span className="method-list-item-label-name">
options
</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">
No description provided.
</div>
<ul className="method-list-group">
<h5 class="method-list-title method-list-title-isChild expanded">Properties</h5>
<li className="method-list-item">
<h4 className="method-list-item-label">
<span className="method-list-item-label-name">
public
</span>
<span className="method-list-item-label-badge required">
required
</span>
<span className="method-list-item-validation">
<code>boolean</code>
</span>
</h4>
<div class="method-list-item-description">
The visibility of the bucket. Public buckets don't require an authorization token to download objects, but still require a valid token for all other operations.
</div>
</li>
</ul>
</li>
</ul>
## Notes
- RLS policy permissions required:
- `buckets` table permissions: `update`
- `objects` table permissions: none
- Refer to the [Storage guide](/docs/guides/storage#access-control) on how access control works
## Examples
### Update bucket
```js
const { data, error } = await supabase.storage.updateBucket('avatars', {
public: false,
})
```