如何在具有Azure功能的Azure Blob中附加文本文件 [英] How to Append a Text File in an Azure Blob with a Azure Function

查看:42
本文介绍了如何在具有Azure功能的Azure Blob中附加文本文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个文本文件,我需要使用计时器Azure函数每天将数据附加到文件中.文本文件是逗号分隔的文件.我已经创建了CloudBlobClient,并且知道如何制定共享访问策略和令牌.我只是不知道如何使用它来上传.我只知道如何从正在使用的教程中获取访问URI.

I've got a text file I need to append data to daily with a timer Azure Function. The text file is a comma separated file. I've created my CloudBlobClient and knew how to make my Shared Access Policy and Token. I just don't know how to use this to upload. I only know how to get an access URI from the tutorial I'm working with.

推荐答案

我有一个文本文件,需要每天使用计时器Azure函数将数据附加到其中.

I've got a text file I need to append data to daily with a timer Azure Function.

您可以尝试使用针对附加操作优化的附加blob.根据您的描述,您知道如何获取 SAS URI ,因此您可以使用SAS URI创建对附加Blob的引用,并将文件附加到附加Blob,以下代码供您参考.

You can try to use append blob that is optimized for append operations. According to your description, you know how to get SAS URI, so you can use SAS URI to create a reference to an append blob, and append a file to an append blob, the following code is for your reference.

CloudAppendBlob appendBlob = new CloudAppendBlob(new Uri("https://{storage_account}.blob.core.windows.net/{your_container}/append-blob.log?st=2017-09-25T02%3A10%3A00Z&se=2017-09-27T02%3A10%3A00Z&sp=rwl&sv=2015-04-05&sr=b&sig=d0MENO44GjtBLf7L8U%2B%2F2nGwPAayjiVSSHaKJgEkmIs%3D"));


appendBlob.AppendFromFile("{filepath}\source.txt");

这篇关于如何在具有Azure功能的Azure Blob中附加文本文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆