NebStore SDK bucket operations
This reference page lists all operations you can do to manage your storage buckets with Nebula.
Create bucket
Creates a bucket in the project that the API key belongs to.
Sample
const newBucket = {
bucketName: 'my-new-bucket',
region: 'sa-1',
isPrivate: true,
}
const response = await nebStore.createBucket(newBucket)
console.log(response)
Attribute | Format | Required? | Desription |
---|---|---|---|
bucketName | string | required | Create a bucket using this bucket name. Check out the bucket naming conventions here. |
region | string | required | Create a bucket in this hosting region. Possible value: sa-1 . |
isPrivate | boolean | optional | Set to false if you want to allow public access to the objects in this bucket. Defaults to true . |
Get bucket
Retrieves details about a bucket based on its name.
Sample
const response = await nebStore.getBucket('bucketName')
console.log(response)
Attribute | Format | Required? | Desription |
---|---|---|---|
bucketName | string | required | The name of the bucket you want to retrieve. |
List buckets
Lists details about all buckets in the project that the API key belongs to. The results can be paginated. The results can also be filtered using startDate
and endDate
which are based on the creation date of your buckets.
Sample
const params = {
page: 1,
limit: 10,
startDate: new Date('2024-10-15'),
endDate: new Date('2024-10-20'),
}
const response = await nebStore.listBuckets(params)
console.log(response)
Attribute | Format | Required? | Desription |
---|---|---|---|
page | number | optional | Jump to a specific page of results. |
limit | number | optional | Limit the number of items on a result page. |
startDate | string | optional | The starting date for filtering buckets based on the date they were created. This attribute accepts ISO 8601 dates in YYYY-MM-DD format. |
endDate | string | optional | The ending date for filtering buckets based on the date they were created. This attribute accepts ISO 8601 dates in YYYY-MM-DD format. |
Empty bucket
Removes all objects from a bucket. This is required before you can delete the bucket.
Sample
const response = await nebStore.emptyBucket('bucketName')
console.log(response)
Attribute | Format | Required? | Desription |
---|---|---|---|
bucketName | string | required | The name of the bucket you want to empty. |
Delete bucket
Deletes a bucket. Only empty buckets can be deleted.
Sample
const response = await nebStore.deleteBucket('bucketName')
console.log(response)
Attribute | Format | Required? | Desription |
---|---|---|---|
bucketName | string | required | The name of the bucket you want to delete. |
Need help?
If you have any technical questions or bump into any problems, get in touch with our Support team! We are here to help, and welcome any feedback you might have about NebStore.