Firebase Storage C# library
Before we talk about the library I recommend you to get familiar with Firebase Storage. You can read about it in the official docs. In your Firebase Console just click on Storage and you will see all files uploaded to your app. You can also specify your custom rules to allow or deny uploading to specific folders.
- Upload any content to Firebase Storage
- Get a download link
- Delete files
Here is a sample use (.NET Framework 4.5):
As you can see, it is fairly simple. When you call PutAsync to upload the file you get back an instance of FirebaseStorageTask. You can attach an event handler to it to track the upload progress and use await to wait until the upload finishes.
What you may have noticed about the PutAsync method is that it does not actually accept a file reference as its parameter but rather a Stream. This makes it easier to keep this library multi-platform and allows you to upload any content — not just files. For example you can use MemoryStream to construct the content in memory and then just upload it as if it were a file.
In case you are wondering, yes, authentication is also supported. Check out my post about FirebaseAuthentication.net, it works the same way here.
For more samples, check out the Github repository. Other than authentication the sample also shows you how to cancel a running upload.
Where can I get the library?
Install it via Nuget:
Install-Package FirebaseStorage.net -pre
Following frameworks are supported:
- .NET 4.5+
- Windows 8.x
- Windows Phone 8.1
If you have any questions or encounter any errors just raise an issue on GitHub.