Calculate Document
@google-cloud/storage

@google-cloud/storage

Node.js idiomatic client for Cloud storage. Cloud storage allows world-wide storage andretrieval of any amount of data at any time. You can use G

Related articles

Best Free VPN for Windows: The Top 5 REALLY FREE VPNs for Windows VPN Unlimited Review 2024: What Is It Good For? Rainbow Cloud Craft Cloud seeding 【教學】如何在路由器上安裝 VPN?NETGEAR、TP-Link、ASUS

Node.js idiomatic client for Cloud storage.

Cloud storage allows world-wide
storage andretrieval of any amount of data at any time. You can use Google
Cloud storage for a range of scenarios including serving website content,
storing data for archival anddisaster recovery, or distributing large data
objects to users via direct download.

A comprehensive list of changes in each version may be found in
the CHANGELOG.

Read more about the client libraries for Cloud APIs, including the older
Google APIs Client Libraries, in Client Libraries Explained.

Table of content :

  1. Select or create a Cloud Platform project.
  2. Enable billing for your project.
  3. Enable the Google Cloud storage API.
  4. Set up authentication so you can access the
    API from your local workstation.

Installing the client library

npm install @google-cloud/storage
// Imports the Google Cloud client library
const {storage} = require(' @google - cloud / storage ');

// For more information on ways to initialize storage, please see
// https://googleapis.dev/nodejs/storage/latest/storage.html

// create a client using Application Default Credentials
const storage = new storage();

// Creates a client from a Google service account key
// const storage = new storage({keyFilename: 'key.json'});

/ * *
 * TODO(developer): Uncomment these variables before running the sample.
 */
// The ID of your GCS bucket
// const bucketName = 'your-unique-bucket-name';

async function createbucket() {
  // Creates the new bucket
  await storage.createbucket(bucketName);
  console.log(`Bucket ${bucketName} created.`);
}

createbucket().catch(console.error);

Samples are in the samples/ directory . Each sample ‘sREADME.md has instructions for running its sample.

The Google Cloud storage Node.js Client API Reference documentation
also contains samples.

Supported Node.js Versions

Our client libraries follow the Node.js release schedule.
Libraries are compatible with all current active andmaintenance versions of
Node.js.
If you are using an end-of-life version of Node.js, we recommend that you update
as soon as possible to an actively supported LTS version.

Google ‘s client libraries is support support legacy version of Node.js runtime on a
good – effort basis with the follow warning :

  • Legacy versions are not tested in continuous integration.
  • Some security patches andfeatures cannot be backported.
  • Dependencies cannot be kept up-to-date.

Client libraries targeting some end-of-life versions of Node.js are available, and
can be installed through npm dist-tags.
The dist-tags follow the naming convention legacy-(version).
For example ,npm install @google-cloud/storage@legacy-8 installs client libraries
for versions compatible with Node.js 8.

This library follows Semantic Versioning.

This library is considered to be stable. The code surface will not change in backwards-incompatible ways
unless absolutely necessary (e.g. because of critical security issues) or with
an extensive deprecation period. Issues andrequests against stable libraries
are addressed with the highest priority.

More information : Google Cloud Platform Launch stage

Contributions welcome! See the Contributing Guide.

Please note that this README.md, the samples/README.md,
and a variety of configuration files in this repository (including .nycrc andtsconfig.json)
are generated from a central template. To edit one of these files, make an edit
to its templates in
directory.

Apache Version 2.0

See LICENSE