Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to move files with firebase storage?

Is there a way to move files with firebase.storage()?

Example: user1/public/image.jpg to user1/private/image.jpg

like image 435
felipepastorelima Avatar asked Jul 26 '16 23:07

felipepastorelima


People also ask

Can I store files in Firebase?

You asked for it, and it's finally here: file storage for Firebase developers! Firebase Storage is a stand-alone solution for uploading user generated content like images and videos from an iOS and Android device, as well as the Web.

How do I move items to the cloud storage?

First, you order the appliance through the Cloud Console. Once it is shipped to you, you copy your data to the appliance (via a file copy over NFS), where the data is encrypted and secured. Finally, you ship the appliance back to Google for data transfer into your GCS bucket and the data is erased from the appliance.


2 Answers

Since Firebase Storage is backed by Google Cloud Storage, you can use GCS's rewrite API (docs) or gsutil mv (docs).

Also, an example of move (docs) in GCloud Node follows:

var bucket = gcs.bucket('my-bucket'); var file = bucket.file('my-image.png'); var newLocation = 'gs://another-bucket/my-image-new.png'; file.move(newLocation, function(err, destinationFile, apiResponse) {   // `my-bucket` no longer contains:   // - "my-image.png"   //   // `another-bucket` now contains:   // - "my-image-new.png"    // `destinationFile` is an instance of a File object that refers to your   // new file. }); 
like image 93
Mike McDonald Avatar answered Oct 07 '22 06:10

Mike McDonald


There is no such way to move to other location, rather you can download and then put it to other reference and deleting the previous location.

like image 25
Sahaj Rana Avatar answered Oct 07 '22 05:10

Sahaj Rana