Node.js client for Google Cloud Storage: unified object storage for developers and enterprises, from live data serving to data analytics/ML to data archiving.
Installations
npm install @google-cloud/storage
Score
64
Supply Chain
97.5
Quality
86.1
Maintenance
100
Vulnerability
100
License
Developer
Developer Guide
Module System
ESM
Min. Node Version
>=14
Typescript Support
Yes
Node Version
18.18.2
NPM Version
9.8.1
Statistics
903 Stars
1,310 Commits
370 Forks
70 Watching
11 Branches
194 Contributors
Updated on 25 Nov 2024
Bundle Size
511.93 kB
Minified
155.64 kB
Minified + Gzipped
Languages
TypeScript (94.04%)
HTML (5.59%)
JavaScript (0.26%)
Python (0.1%)
Total Downloads
Cumulative downloads
Total Downloads
616,068,641
Last day
2.3%
750,169
Compared to previous day
Last week
3%
3,913,044
Compared to previous week
Last month
9.5%
16,522,217
Compared to previous month
Last year
27.3%
168,833,441
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
15
Dev Dependencies
38
Google Cloud Storage: Node.js Client
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.
- Google Cloud Storage Node.js Client API Reference
- Google Cloud Storage Documentation
- github.com/googleapis/nodejs-storage
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
- Select or create a Cloud Platform project.
- Enable billing for your project.
- Enable the Google Cloud Storage API.
- Set up authentication so you can access the API from your local workstation.
Installing the client library
1npm install @google-cloud/storage
Using the client library
1// Imports the Google Cloud client library 2const {Storage} = require('@google-cloud/storage'); 3 4// For more information on ways to initialize Storage, please see 5// https://googleapis.dev/nodejs/storage/latest/Storage.html 6 7// Creates a client using Application Default Credentials 8const storage = new Storage(); 9 10// Creates a client from a Google service account key 11// const storage = new Storage({keyFilename: 'key.json'}); 12 13/** 14 * TODO(developer): Uncomment these variables before running the sample. 15 */ 16// The ID of your GCS bucket 17// const bucketName = 'your-unique-bucket-name'; 18 19async function createBucket() { 20 // Creates the new bucket 21 await storage.createBucket(bucketName); 22 console.log(`Bucket ${bucketName} created.`); 23} 24 25createBucket().catch(console.error); 26
Samples
Samples are in the samples/
directory. Each sample's README.md
has instructions for running its sample.
Sample | Source Code | Try it |
---|---|---|
Add Bucket Conditional Binding | source code | |
Add Bucket Default Owner Acl | source code | |
Add Bucket Iam Member | source code | |
Storage Add Bucket Label. | source code | |
Add Bucket Owner Acl | source code | |
Bucket Website Configuration. | source code | |
Add File Owner Acl | source code | |
Storage Get Bucket Metadata. | source code | |
Change Bucket's Default Storage Class. | source code | |
Storage File Convert CSEK to CMEK. | source code | |
Storage Combine files. | source code | |
Storage Configure Bucket Cors. | source code | |
Configure Retries | source code | |
Copy File | source code | |
Copy Old Version Of File. | source code | |
Create a Dual-Region Bucket | source code | |
Create a hierarchical namespace enabled bucket | source code | |
Create a Bucket with object retention enabled. | source code | |
Create Bucket With Storage Class and Location. | source code | |
Create Bucket With Turbo Replication | source code | |
Create New Bucket | source code | |
Create Notification | source code | |
Delete Bucket | source code | |
Delete File | source code | |
Delete Notification | source code | |
Delete Old Version Of File. | source code | |
Disable Bucket Lifecycle Management | source code | |
Storage Disable Bucket Versioning. | source code | |
Disable Default Event Based Hold | source code | |
Disable Requester Pays | source code | |
Disable Uniform Bucket Level Access | source code | |
Download Byte Range | source code | |
Download Encrypted File | source code | |
Download File | source code | |
Download a File in Chunks With Transfer Manager | source code | |
Download File Using Requester Pays | source code | |
Download Folder With Transfer Manager | source code | |
Download Into Memory | source code | |
Download Many Files With Transfer Manager | source code | |
Storage Download Public File. | source code | |
Enable Bucket Lifecycle Management | source code | |
Storage Enable Bucket Versioning. | source code | |
Enable Default Event Based Hold | source code | |
Enable Default KMS Key | source code | |
Enable Requester Pays | source code | |
Enable Uniform Bucket Level Access | source code | |
Change File's Storage Class. | source code | |
Storage Set File Metadata. | source code | |
Generate Encryption Key | source code | |
Generate Signed Url | source code | |
Generate V4 Read Signed Url | source code | |
Generate V4 Signed Policy | source code | |
Generate V4 Upload Signed Url | source code | |
Get Autoclass | source code | |
Get Default Event Based Hold | source code | |
Get Metadata | source code | |
Get Metadata Notifications | source code | |
Get Public Access Prevention | source code | |
Get RPO | source code | |
Get Requester Pays Status | source code | |
Get Retention Policy | source code | |
Storage Get Service Account. | source code | |
Get Uniform Bucket Level Access | source code | |
Activate HMAC SA Key. | source code | |
Create HMAC SA Key. | source code | |
Deactivate HMAC SA Key. | source code | |
Delete HMAC SA Key. | source code | |
Get HMAC SA Key Metadata. | source code | |
List HMAC SA Keys Metadata. | source code | |
List Buckets | source code | |
List Files | source code | |
List Files By Prefix | source code | |
List Files Paginate | source code | |
List Files with Old Versions. | source code | |
List Notifications | source code | |
Lock Retention Policy | source code | |
Storage Make Bucket Public. | source code | |
Make Public | source code | |
Move File | source code | |
Print Bucket Acl | source code | |
Print Bucket Acl For User | source code | |
Print File Acl | source code | |
Print File Acl For User | source code | |
Quickstart | source code | |
Release Event Based Hold | source code | |
Release Temporary Hold | source code | |
Remove Bucket Conditional Binding | source code | |
Storage Remove Bucket Cors Configuration. | source code | |
Remove Bucket Default Owner | source code | |
Remove Bucket Iam Member | source code | |
Storage Remove Bucket Label. | source code | |
Remove Bucket Owner Acl | source code | |
Remove Default KMS Key. | source code | |
Remove File Owner Acl | source code | |
Remove Retention Policy | source code | |
Rename File | source code | |
Rotate Encryption Key | source code | |
Set Autoclass | source code | |
Set Client Endpoint | source code | |
Set Event Based Hold | source code | |
Set the object retention policy of a File. | source code | |
Set Public Access Prevention Enforced | source code | |
Set Public Access Prevention Inherited | source code | |
Set RPO Async Turbo | source code | |
Set RPO Default | source code | |
Set Retention Policy | source code | |
Set Temporary Hold | source code | |
Stream File Download | source code | |
Stream File Upload | source code | |
Upload a directory to a bucket. | source code | |
Upload Directory With Transfer Manager | source code | |
Upload Encrypted File | source code | |
Upload File | source code | |
Upload a File in Chunks With Transfer Manager | source code | |
Upload File With Kms Key | source code | |
Upload From Memory | source code | |
Upload Many Files With Transfer Manager | source code | |
Upload Without Authentication | source code | |
Upload Without Authentication Signed Url | source code | |
View Bucket Iam Members | source code |
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. 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 support legacy versions of Node.js runtimes on a best-efforts basis with the following warnings:
- Legacy versions are not tested in continuous integration.
- Some security patches and features 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.
Versioning
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 and requests against stable 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 templates in
directory.
License
Apache Version 2.0
See LICENSE
No vulnerabilities found.
Reason
13 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10
Reason
security policy file detected
Details
- Info: security policy file detected: SECURITY.md:1
- Info: Found linked content: SECURITY.md:1
- Info: Found disclosure, vulnerability, and/or timelines in security policy: SECURITY.md:1
- Info: Found text in security policy: SECURITY.md:1
Reason
no dangerous workflow patterns detected
Reason
all changesets reviewed
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0
Reason
0 existing vulnerabilities detected
Reason
SAST tool is not run on all commits -- score normalized to 4
Details
- Warn: 13 commits out of 30 are checked with a SAST tool
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/ci.yaml:1
- Warn: no topLevel permission defined: .github/workflows/conformance-test.yaml:1
- Warn: no topLevel permission defined: .github/workflows/issues-no-repro.yaml:1
- Warn: no topLevel permission defined: .github/workflows/response.yaml:1
- Info: no jobLevel write permissions found
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yaml:43: update your workflow using https://app.stepsecurity.io/secureworkflow/googleapis/nodejs-storage/ci.yaml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yaml:44: update your workflow using https://app.stepsecurity.io/secureworkflow/googleapis/nodejs-storage/ci.yaml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yaml:52: update your workflow using https://app.stepsecurity.io/secureworkflow/googleapis/nodejs-storage/ci.yaml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yaml:53: update your workflow using https://app.stepsecurity.io/secureworkflow/googleapis/nodejs-storage/ci.yaml/main?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yaml:58: update your workflow using https://app.stepsecurity.io/secureworkflow/googleapis/nodejs-storage/ci.yaml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yaml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/googleapis/nodejs-storage/ci.yaml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yaml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/googleapis/nodejs-storage/ci.yaml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yaml:32: update your workflow using https://app.stepsecurity.io/secureworkflow/googleapis/nodejs-storage/ci.yaml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yaml:33: update your workflow using https://app.stepsecurity.io/secureworkflow/googleapis/nodejs-storage/ci.yaml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/conformance-test.yaml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/googleapis/nodejs-storage/conformance-test.yaml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/conformance-test.yaml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/googleapis/nodejs-storage/conformance-test.yaml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/issues-no-repro.yaml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/googleapis/nodejs-storage/issues-no-repro.yaml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/issues-no-repro.yaml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/googleapis/nodejs-storage/issues-no-repro.yaml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/response.yaml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/googleapis/nodejs-storage/response.yaml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/response.yaml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/googleapis/nodejs-storage/response.yaml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/response.yaml:30: update your workflow using https://app.stepsecurity.io/secureworkflow/googleapis/nodejs-storage/response.yaml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/response.yaml:31: update your workflow using https://app.stepsecurity.io/secureworkflow/googleapis/nodejs-storage/response.yaml/main?enable=pin
- Warn: npmCommand not pinned by hash: .kokoro/conformance-test.sh:22
- Warn: npmCommand not pinned by hash: .kokoro/docs.sh:23
- Warn: npmCommand not pinned by hash: .kokoro/lint.sh:23
- Warn: npmCommand not pinned by hash: .kokoro/lint.sh:29
- Warn: npmCommand not pinned by hash: .kokoro/publish.sh:29
- Warn: npmCommand not pinned by hash: .kokoro/release/docs-devsite.sh:27
- Warn: npmCommand not pinned by hash: .kokoro/release/docs-devsite.sh:28
- Warn: npmCommand not pinned by hash: .kokoro/release/docs.sh:27
- Warn: npmCommand not pinned by hash: .kokoro/release/docs.sh:31
- Warn: npmCommand not pinned by hash: .kokoro/samples-test.sh:35
- Warn: npmCommand not pinned by hash: .kokoro/samples-test.sh:40
- Warn: downloadThenRun not pinned by hash: .kokoro/setup-vars.sh:30
- Warn: downloadThenRun not pinned by hash: .kokoro/setup-vars.sh:32
- Warn: downloadThenRun not pinned by hash: .kokoro/setup-vars.sh:38
- Warn: npmCommand not pinned by hash: .kokoro/system-test.sh:40
- Warn: npmCommand not pinned by hash: .kokoro/test.sh:23
- Warn: npmCommand not pinned by hash: .github/workflows/ci.yaml:23
- Warn: npmCommand not pinned by hash: .github/workflows/ci.yaml:26
- Warn: npmCommand not pinned by hash: .github/workflows/ci.yaml:48
- Warn: npmCommand not pinned by hash: .github/workflows/ci.yaml:57
- Warn: npmCommand not pinned by hash: .github/workflows/conformance-test.yaml:17
- Info: 0 out of 16 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 1 third-party GitHubAction dependencies pinned
- Info: 0 out of 3 downloadThenRun dependencies pinned
- Info: 0 out of 18 npmCommand dependencies pinned
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Score
6.8
/10
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to @google-cloud/storage
rollup-plugin-google-cloud-storage
Uploads build assets to a bucket on Google Cloud Storage
@strapi-community/strapi-provider-upload-google-cloud-storage
(Non-official) Google Cloud Storage Provider for Strapi Upload
multer-cloud-storage
Multer storage engine for Google Cloud Storage
reg-publish-gcs-plugin
Fetch and publish snapshot images to Google Cloud Storage.