5.8.5 • Published 2 months ago

@google-cloud/storage v5.8.5

Weekly downloads
1,459,965
License
Apache-2.0
Repository
github
Last release
2 months ago

Google Cloud Storage: Node.js Client

release level npm version codecov

Node.js idiomatic client for Cloud Storage.

Cloud Storage allows world-wide storage and retrieval 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 and disaster 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 contents:

Quickstart

Before you begin

  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 with a service account so you can access the API from your local workstation.

Installing the client library

npm install @google-cloud/storage

Using the client library

// 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

// Creates 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

Samples are in the samples/ directory. Each sample's README.md has instructions for running its sample.

SampleSource CodeTry it
Add Bucket Conditional Bindingsource codeOpen in Cloud Shell
Add Bucket Default Owner Aclsource codeOpen in Cloud Shell
Add Bucket Iam Membersource codeOpen in Cloud Shell
Storage Add Bucket Label.source codeOpen in Cloud Shell
Add Bucket Owner Aclsource codeOpen in Cloud Shell
Bucket Website Configuration.source codeOpen in Cloud Shell
Add File Owner Aclsource codeOpen in Cloud Shell
Storage Get Bucket Metadata.source codeOpen in Cloud Shell
Change Bucket's Default Storage Class.source codeOpen in Cloud Shell
Storage File Convert CSEK to CMEK.source codeOpen in Cloud Shell
Storage Combine files.source codeOpen in Cloud Shell
Storage Configure Bucket Cors.source codeOpen in Cloud Shell
Copy Filesource codeOpen in Cloud Shell
Copy Old Version Of File.source codeOpen in Cloud Shell
Create Bucket With Storage Class and Location.source codeOpen in Cloud Shell
Create New Bucketsource codeOpen in Cloud Shell
Create Notificationsource codeOpen in Cloud Shell
Delete Bucketsource codeOpen in Cloud Shell
Delete Filesource codeOpen in Cloud Shell
Delete Notificationsource codeOpen in Cloud Shell
Delete Old Version Of File.source codeOpen in Cloud Shell
Disable Bucket Lifecycle Managementsource codeOpen in Cloud Shell
Storage Disable Bucket Versioning.source codeOpen in Cloud Shell
Disable Default Event Based Holdsource codeOpen in Cloud Shell
Disable Requester Payssource codeOpen in Cloud Shell
Disable Uniform Bucket Level Accesssource codeOpen in Cloud Shell
Download Encrypted Filesource codeOpen in Cloud Shell
Download Filesource codeOpen in Cloud Shell
Download File Using Requester Payssource codeOpen in Cloud Shell
Storage Download Public File.source codeOpen in Cloud Shell
Enable Bucket Lifecycle Managementsource codeOpen in Cloud Shell
Storage Enable Bucket Versioning.source codeOpen in Cloud Shell
Enable Default Event Based Holdsource codeOpen in Cloud Shell
Enable Default KMS Keysource codeOpen in Cloud Shell
Enable Requester Payssource codeOpen in Cloud Shell
Enable Uniform Bucket Level Accesssource codeOpen in Cloud Shell
Change File's Storage Class.source codeOpen in Cloud Shell
Storage Set File Metadata.source codeOpen in Cloud Shell
Generate Encryption Keysource codeOpen in Cloud Shell
Generate Signed Urlsource codeOpen in Cloud Shell
Generate V4 Read Signed Urlsource codeOpen in Cloud Shell
Generate V4 Signed Policysource codeOpen in Cloud Shell
Generate V4 Upload Signed Urlsource codeOpen in Cloud Shell
Get Default Event Based Holdsource codeOpen in Cloud Shell
Get Metadatasource codeOpen in Cloud Shell
Get Metadata Notificationssource codeOpen in Cloud Shell
Get Requester Pays Statussource codeOpen in Cloud Shell
Get Retention Policysource codeOpen in Cloud Shell
Storage Get Service Account.source codeOpen in Cloud Shell
Get Uniform Bucket Level Accesssource codeOpen in Cloud Shell
Activate HMAC SA Key.source codeOpen in Cloud Shell
Create HMAC SA Key.source codeOpen in Cloud Shell
Deactivate HMAC SA Key.source codeOpen in Cloud Shell
Delete HMAC SA Key.source codeOpen in Cloud Shell
Get HMAC SA Key Metadata.source codeOpen in Cloud Shell
List HMAC SA Keys Metadata.source codeOpen in Cloud Shell
List Bucketssource codeOpen in Cloud Shell
List Filessource codeOpen in Cloud Shell
List Files By Prefixsource codeOpen in Cloud Shell
List Files Paginatesource codeOpen in Cloud Shell
List Files with Old Versions.source codeOpen in Cloud Shell
List Notificationssource codeOpen in Cloud Shell
Lock Retention Policysource codeOpen in Cloud Shell
Storage Make Bucket Public.source codeOpen in Cloud Shell
Make Publicsource codeOpen in Cloud Shell
Move Filesource codeOpen in Cloud Shell
Print Bucket Aclsource codeOpen in Cloud Shell
Print Bucket Acl For Usersource codeOpen in Cloud Shell
Print File Aclsource codeOpen in Cloud Shell
Print File Acl For Usersource codeOpen in Cloud Shell
Quickstartsource codeOpen in Cloud Shell
Release Event Based Holdsource codeOpen in Cloud Shell
Release Temporary Holdsource codeOpen in Cloud Shell
Remove Bucket Conditional Bindingsource codeOpen in Cloud Shell
Storage Remove Bucket Cors Configuration.source codeOpen in Cloud Shell
Remove Bucket Default Ownersource codeOpen in Cloud Shell
Remove Bucket Iam Membersource codeOpen in Cloud Shell
Storage Remove Bucket Label.source codeOpen in Cloud Shell
Remove Bucket Owner Aclsource codeOpen in Cloud Shell
Remove Default KMS Key.source codeOpen in Cloud Shell
Remove File Owner Aclsource codeOpen in Cloud Shell
Remove Retention Policysource codeOpen in Cloud Shell
Rename Filesource codeOpen in Cloud Shell
Rotate Encryption Keysource codeOpen in Cloud Shell
Set Event Based Holdsource codeOpen in Cloud Shell
Set Retention Policysource codeOpen in Cloud Shell
Set Temporary Holdsource codeOpen in Cloud Shell
Upload a directory to a bucket.source codeOpen in Cloud Shell
Upload Encrypted Filesource codeOpen in Cloud Shell
Upload Filesource codeOpen in Cloud Shell
Upload File With Kms Keysource codeOpen in Cloud Shell
View Bucket Iam Memberssource codeOpen in Cloud Shell

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 and maintenance versions of Node.js.

Client libraries targeting some end-of-life versions of Node.js are available, and can be installed via npm dist-tags. The dist-tags follow the naming convention legacy-(version).

Legacy Node.js versions are supported as a best effort:

  • Legacy versions will not be tested in continuous integration.
  • Some security patches may not be able to be backported.
  • Dependencies will not be kept up-to-date, and features will not be backported.

Legacy tags available

  • legacy-8: install client libraries from this dist-tag for versions compatible with Node.js 8.

Versioning

This library follows Semantic Versioning.

This library is considered to be General Availability (GA). This means it is 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 and requests against GA libraries are addressed with the highest priority.

More Information: Google Cloud Platform Launch Stages

Contributing

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 and tsconfig.json) are generated from a central template. To edit one of these files, make an edit to its template in this directory.

License

Apache Version 2.0

See LICENSE

feathers-advance-hooklamda-test@applitools/snapshot-server-app@beyonk/cliwalrus-apibrandify-core-libdriveit-databaseseditor-servernx-gcs-cachesnitch2invoicewave_backmc-change-history-search-gcfmc-change-history-sync-actions-gcfemkservicesavailability-graphql-apicompositor-enginestudybear-apired-contrib-google-cloud-gcs-delete@handoff/exporterftp-fetch-and-unzip@t360/googlecloudwant2talk-webserverprodumpnode-image-processing-cloud-functionelectron-patches@csdevcloud/cs-coreserverless-resize-bucket-imagesmyid-backelectron-publisher-gcselectron-forge-publish-google-storageember-cli-deploy-gcloud-storageember-cli-deploy-gcs-indexelectron-firebasegatsby-source-google-storagegatsby-source-gcloud-objectgatsby-source-gcp-storagegcs-blob-storegcs-bulk-uploadgcs-cigcs-downloadergcs-envgcs-file-uploadgcs-fusegcs-multergcs-multer-wrappergcs-mutex-lockgcs-uploadgcs-utilsgcs-webpack-plugingcsfsgcsliftgcp-utilitygcp_object_uploadgcp-object-storagegcp-configgcp-ddf-resource-readergcloud-storage-downloadergcloud-storage-uploadgcf-utilsgcloud-backupgcloud-bucket-uploadgcloud-deploygcp-inventorygc-storage-filesgenesis-librarycore-cloud-services-clientsi18n-cloud-syncimage-resizingjotive-firebase-storage-moduleknube-deployimforza-clikratos-serverhttps-tus-node-serverimport-map-deployer@aginix/gcloud-storage@aginix/nestjs-gcloud-storage@adobe/helix-deploy@aicial/ghost-storage-google-cloud@aarconada/urserver@3wks/gae-node-nestjs@aeco-cloud/continuous-delivery-cra@admin-bro/upload@17grad/build17jsreport-gcp-storage@digitalmomentum/storage@digitalspaces/runtime-basemead-plugin-source-gcs@dfloresdev/google-storage-ghostlowdb-google-cloud-storage-adaptermarknavi-mail-api-hapimaybe-jsonlocation-aware-hybrid-cloudmashrlambda-framework-gcloudlighthouse-gcp-bigquerylightcraftlike-fs-gcskeystone-google-cloud-storage-adapterkeystone-storage-adapter-cloud-storage@aheadai/unit
5.8.5

2 months ago

5.8.4

2 months ago

5.8.3

3 months ago

5.8.2

3 months ago

5.8.1

4 months ago

5.8.0

4 months ago

5.7.4

5 months ago

5.7.3

5 months ago

5.7.2

5 months ago

5.7.1

5 months ago

5.7.0

6 months ago

5.6.0

7 months ago

5.5.1

7 months ago

5.5.0

7 months ago

5.4.0

8 months ago

5.3.0

10 months ago

5.2.0

10 months ago

5.1.2

11 months ago

5.1.1

12 months ago

5.1.0

1 year ago

5.0.1

1 year ago

5.0.0

1 year ago

4.7.0

1 year ago

4.6.0

1 year ago

4.5.0

1 year ago

4.4.0

1 year ago

4.3.2

1 year ago

4.3.1

1 year ago

4.3.0

1 year ago

4.2.0

1 year ago

4.1.3

2 years ago

4.1.2

2 years ago

4.1.1

2 years ago

4.1.0

2 years ago

4.0.1

2 years ago

4.0.0

2 years ago

3.5.0

2 years ago

3.4.0

2 years ago

3.3.1

2 years ago

3.3.0

2 years ago

3.2.1

2 years ago

3.2.0

2 years ago

3.1.0

2 years ago

3.0.4

2 years ago

3.0.3

2 years ago

3.0.2

2 years ago

3.0.1

2 years ago

3.0.0

2 years ago

2.5.0

2 years ago

2.4.3

2 years ago

2.4.2

2 years ago

2.4.1

2 years ago

2.4.0

2 years ago

2.3.4

2 years ago

2.3.3

3 years ago

2.3.1

3 years ago

2.3.0

3 years ago

2.2.0

3 years ago

2.1.0

3 years ago

2.0.3

3 years ago

2.0.2

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.7.0

3 years ago

1.6.0

3 years ago

1.5.2

3 years ago

1.5.1

4 years ago

1.5.0

4 years ago

1.4.0

4 years ago

1.3.1

4 years ago

1.3.0

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.0

4 years ago

0.8.0

4 years ago

0.7.0

4 years ago

0.6.1

4 years ago

0.5.2

4 years ago

0.5.1

4 years ago

0.6.0

5 years ago

0.5.0

5 years ago

0.4.0

5 years ago

0.3.0

5 years ago

0.2.0

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago