admin管理员组文章数量:1336401
Firebase storage is based on Google Cloud Platform which allows versioning of files.
In the Firebase console there are no options regarding the GCP bucket, and when accessing the GCP console, there doesn't seem to be a way on enabling versioning in the bucket pertaining to the Firebase project.
Also, the Firebase SDK does not mention how to access previous versions of files even if versioning was enabled.
Is versioning possible with Firebase Storage?
Firebase storage is based on Google Cloud Platform which allows versioning of files.
In the Firebase console there are no options regarding the GCP bucket, and when accessing the GCP console, there doesn't seem to be a way on enabling versioning in the bucket pertaining to the Firebase project.
Also, the Firebase SDK does not mention how to access previous versions of files even if versioning was enabled.
Is versioning possible with Firebase Storage?
Share asked Jun 6, 2016 at 18:54 PierPier 10.8k17 gold badges72 silver badges118 bronze badges2 Answers
Reset to default 9Firebase Storage is built on GCS so many of the features of GCS can be accessed via Firebase Storage. Firebase Storage also shares a GCS bucket named <project-id>.appspot.
(or similar), that can be accessed via both the Firebase console and the Cloud console.
You can enable object versioning on your bucket by using the gsutil tool (probably the easiest way) like so:
gsutil versioning set on gs://<project-id>.appspot.
That said, there's no way of using the Firebase Storage clients to retrieve anything other than the most recent version. This was intentional, since Firebase Storage provides a simpler, mobile focused subset of the GCS APIs, and we didn't have a super pelling use case for providing an intuitive object versioning story for mobile. Per user data backups (initiated by the user without dev intervention), and document diffs are the two I can think of, but if you've got another, we'd love to hear it :)
We anticipate that a majority of devs will turn this on in order to prevent deletions from being permanent (and indeed, we mention doing this in our delete docs), and will thus use tools like gsutil
or their own custom backends to retrieve and restore the appropriate files.
EDIT 10/1: Since these use cases have bee more mon, we've updated our docs to include more things you can do with Google Cloud Platform in our GCP Integration guide.
After Object Versioning enabled its possible to listing noncurrent object versions.
Get previous object version:
Long previousGeneration = ...;
byte[] previousContent = bucket.getStorage().get(BlobId.of(bucket.getName(), objectName, previousGeneration)).getContent();
本文标签: javascriptHow to enable and use file versioning in Firebase StorageStack Overflow
版权声明:本文标题:javascript - How to enable and use file versioning in Firebase Storage? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742404523a2468548.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论