Created
August 7, 2021 11:54
-
-
Save dataslayermedia/f40bcccad662bc31bfd9beedf94311a7 to your computer and use it in GitHub Desktop.
Example Script to Download a File From Google Cloud Storage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Imports the Google Cloud client library | |
const { | |
Storage | |
} = require('@google-cloud/storage'); | |
// Creates a client | |
const storage = new Storage(); | |
(async function () { | |
// Downloads the file | |
await storage.bucket('gcloud-demo-223').file('outside.mp4').download({ | |
destination: "./outside.mp4", | |
}); | |
}()); | |
// Command Line Execution | |
// GOOGLE_APPLICATION_CREDENTIALS="/Users/refactored/Desktop/gcloud-demo-tutorial.json" node cli.js |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment