IPWorks Cloud 2020 Node.js Edition

Questions / Feedback?

CreateBucket Method

Creates a new bucket.

Syntax

backblazeb2.createBucket(bucketName, kind, [callback])

Callback

The 'callback' parameter specifies a function which will be called when the operation completes (or an error is encountered). If the 'callback' parameter is not specified, then the method will block and will not return until the operation completes (or an error is encountered).

The callback for this method is defined as:

function(err, data){ }

'err' is the error that occurred. If there was no error, then 'err' is 'null'.

'data' is the value returned by the method.

'err' has 2 properties which hold detailed information:

err.code
err.message

Remarks

This method creates a new bucket named BucketName of the specified Kind. Valid values for Kind are allPrivate (default if empty) and allPublic. Each account may have up to 100 buckets.

The value passed for BucketName must comply with the following restrictions:

  • Must be between 6 and 50 characters long (inclusive).
  • Must consist solely of letters, digits, and hyphens (-).
  • Cannot start with the string b2-.
  • Must be globally unique (i.e., no two accounts may have a bucket with the same name) when compared case-insensitively.

If any items are present in the Metadata* properties, they will also be included in the request and applied to the newly-created bucket. Keep in mind that the server enforces a limit of 10 metadata items per bucket.

The currently-authenticated application key must have the writeBuckets capability to call this method successfully, otherwise the server will return an error. Refer to the AccountCapabilities property for more information.

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks Cloud 2020 Node.js Edition - Version 20.0 [Build 8265]