@google-cloud/storage 2.5.0 » Class: Storage

Storage

class

ACLs

Cloud Storage uses access control lists (ACLs) to manage object and bucket access. ACLs are the mechanism you use to share files with other users and allow other users to access your buckets and files.

Constructor

Storage

Parameter

Properties

acl

static

object

Cloud Storage uses access control lists (ACLs) to manage object and bucket access. ACLs are the mechanism you use to share objects with other users and allow other users to access your buckets and objects.

This object provides constants to refer to the three permission levels that can be granted to an entity:

Parameter

Example

const {Storage} = require('@google-cloud/storage');
const storage = new Storage();
storage.getBuckets(function(err, buckets) {
if (!err) {
// buckets is an array of Bucket objects.
}
});
//-
// To control how many API requests are made and page through the results
// manually, set `autoPaginate` to `false`.
//-
const callback = function(err, buckets, nextQuery, apiResponse) {
if (nextQuery) {
// More results exist.
storage.getBuckets(nextQuery, callback);
}
// The `metadata` property is populated for you with the metadata at the
// time of fetching.
buckets[0].metadata;
// However, in cases where you are concerned the metadata could have
// changed, use the `getMetadata` method.
buckets[0].getMetadata(function(err, metadata, apiResponse) {});
};
storage.getBuckets({
autoPaginate: false
}, callback);
//-
// If the callback is omitted, we'll return a Promise.
//-
storage.getBuckets().then(function(data) {
const buckets = data[0];
});