firebase / firebase-admin-node

Firebase Admin Node.js SDK
https://firebase.google.com/docs/admin/setup
Apache License 2.0
1.63k stars 370 forks source link

Deleting a file from firebase storage #204

Closed soryy708 closed 6 years ago

soryy708 commented 6 years ago

[READ] Step 1: Are you in the right place?

[REQUIRED] Step 2: Describe your environment

[REQUIRED] Step 3: Describe the problem

I can't do anything with the storage object. How do I use this? (documentation is very lean)

Relevant Code:

var admin = require("firebase-admin");
var bucket = /* ... */;
admin.initializeApp({credential: /* ... */}, databaseURL: /* ... */, storageBucket: bucket);
admin.storage().bucket(bucket).refFromURL(/* ... */).delete()
.then(function() {
    console.log("deleted successfully!");
})
.catch(function() {
    console.log("unable to delete");
});
hiranya911 commented 6 years ago

There's no refFromURL() method on Bucket. Here are the API docs: https://cloud.google.com/nodejs/docs/reference/storage/1.5.x/Bucket

Here's a delete example from our tests: https://github.com/firebase/firebase-admin-node/blob/master/test/integration/storage.spec.ts#L60

ardwiinoo commented 3 months ago

very cool sir