Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dataslayermedia/f40bcccad662bc31bfd9beedf94311a7 to your computer and use it in GitHub Desktop.
Save dataslayermedia/f40bcccad662bc31bfd9beedf94311a7 to your computer and use it in GitHub Desktop.
Example Script to Download a File From Google Cloud Storage
// 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