mirror of
https://github.com/supabase/supabase.git
synced 2026-06-08 02:25:04 +08:00
migrates everything from ipip's branch
This commit is contained in:
@@ -0,0 +1,142 @@
|
||||
---
|
||||
id: storage-createbucket
|
||||
title: "createBucket()"
|
||||
slug: storage-createbucket
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/supabase.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
Creates a new Storage bucket
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="js"
|
||||
groupId="reference/supabase-js"
|
||||
values={[{ label: 'JavaScript', value: 'js' }]}>
|
||||
|
||||
<TabsPanel id="js" label="js">
|
||||
|
||||
```js
|
||||
const { data, error } = await supabase
|
||||
.storage
|
||||
.createBucket('avatars', { public: false })
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
## 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 creating.
|
||||
|
||||
</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">
|
||||
|
||||
No description provided.
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
## Notes
|
||||
|
||||
- Policy permissions required:
|
||||
- `buckets` permissions: `insert`
|
||||
- `objects` permissions: none
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### Create bucket
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="js"
|
||||
groupId="reference/supabase-js"
|
||||
values={[{ label: 'JavaScript', value: 'js' }]}>
|
||||
|
||||
<TabsPanel id="js" label="js">
|
||||
|
||||
```js
|
||||
const { data, error } = await supabase
|
||||
.storage
|
||||
.createBucket('avatars', { public: false })
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
Reference in New Issue
Block a user