C#将PDF文件上传到Firebase项目存储?

时间:2016-12-01 14:10:36

标签: c# file firebase firebase-storage

你们知道如何将PDF文件直接上传到Firebase项目存储吗? 我在互联网上搜索了很多,但我一无所获。

C#是否有一些图书馆?或者是否有C#和Firebase的文档?

请帮帮我们!感谢

编辑:

好的,我找到了一个库:FirebaseSharp。

https://github.com/bubbafat/FirebaseSharp

但是这个Lib只支持以前版本的Firebase,也没有存储支持。

1 个答案:

答案 0 :(得分:3)

试试FirebaseStorage.net库。

以下是一个示例用法:

// Get any Stream - it can be FileStream, MemoryStream or any other type of Stream
var stream = File.Open(@"C:\Users\you\file.png", FileMode.Open);

// Construct FirebaseStorage, path to where you want to upload the file and Put it there
var task = new FirebaseStorage("your-bucket.appspot.com")
    .Child("data")
    .Child("random")
    .Child("file.png")
    .PutAsync(stream);

// Track progress of the upload
task.Progress.ProgressChanged += (s, e) => Console.WriteLine($"Progress: {e.Percentage} %");

// await the task to wait until upload completes and get the download url
var downloadUrl = await task;

还有一个相关的blog post