Skip to content

can not connect google @ google-cloud / storage to the project. #385

Description

@alexanderkhitev

Hello! I tried to connect google cloud storage to the project as follows.

MacBook-Pro:node_modules alexsanderjob$ npm install --save @google-cloud/storage
npm WARN deprecated [email protected]: Use uuid module instead
functions@ /Users/alexsanderjob/Desktop/ExampleCloudFunctions/functions
└── @google-cloud/[email protected] 

I wrote the following code in index.js

// Imports the Google Cloud client library
const Storage = require('@google-cloud/storage');

// Your Google Cloud Platform project ID
const projectId = 'example-example7';

// Instantiates a client
const storageClient = Storage({
  projectId: projectId
});

When I open this file through the Visual Studio Code, and when I try to interact with the storage client, nothing happens. My case is the following, I need to delete photos of user cards from Firebase Storage when it deleted my account. Please tell me how it can be done?

Activity

  1. jmdobry commented on May 10, 2017

    @jmdobry
    Member

    Delete a single file in a bucket

    Delete all files in a bucket:

    const Storage = require('@google-cloud/storage');
    
    // Instantiates a client
    const storageClient = Storage({ projectId: 'example-example7' });
    
    // References an existing bucket, e.g. "my-bucket"
    const bucket = storageClient.bucket('my-bucket');
    
    // Deletes all files in the bucket
    bucket.deleteFiles()
      .then(() => {
        console.log('All files deleted.');
      })
      .catch((err) => {
        console.error('ERROR:', err);
      });

    Delete a bucket

  2. ace-n commented on Aug 21, 2017

    @ace-n
    Contributor

    Closing due to staleness; @alexsanderkhitev feel free to reopen if you're still having trouble. Thanks!

  3. added a commit that references this issue on Nov 8, 2022
  4. added a commit that references this issue on Nov 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    🚨This issue needs some love.triage meI really want to be triaged.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions