简体   繁体   English

如何读取Azure存储容器中txt文件的内容?

[英]How do I read the content of a txt file in Azure Storage Container?

I have an container in my Azure storage and i just want to read the content of the txt files and the date the file was created. 我的Azure存储中有一个容器,我只想读取txt文件的内容和文件的创建日期。 I do not wish to download the file itself. 我不希望下载文件本身。 i found some answers to that but the once i found where out of date. 我找到了一些答案,但有一次我发现过时了。

Downloading the file and reading the content is essentially the same thing, just wording. 下载文件和阅读内容本质上是同一件事,只是措辞而已。 No need to save the file physically to disk. 无需将文件物理保存到磁盘。 You can do a .DownloadText() on your CloudBlockBlob object, which returns a string. 您可以在CloudBlockBlob对象上执行.DownloadText(),该对象返回一个字符串。

var cloudBlockBlob = GetCloudBlockBlob();
cloudBlockBlob.FetchAttributes();
var created = cloudBlockBlob.Properties.Created;
var content = cloudBlockBlob.DownloadText();

You obviously need to implement your own GetCloudBlockBlob() method. 您显然需要实现自己的GetCloudBlockBlob()方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在不下载的情况下读取 Azure 容器中的压缩 txt 文件(blob)? - How to read Zipped txt file (blob) which locates in Azure container without downloading? 如何读取file.txt行中的内容 - How to read content in a line of a file.txt 如何在C#中读取一行.txt文件? - How do I read one line for a .txt file in c#? 如何在C#中读取和编辑.txt文件? - How do I read and edit a .txt file in C#? 如何从解决方案项中添加的.txt文件中读取 - How do I read from a .txt file added in solution items 如何删除 Azure 文件存储文件夹中的所有文件? - How do I delete all files in an Azure File Storage folder? 如何从 Azure 存储队列的消息文本字段中读取 JSON 字符串(使用 Azure 函数)? - How do I read a JSON string from the Message Text field in an Azure Storage queue (using an Azure function)? 如何使用 BlobLeaseClient 租用 Azure 存储容器中的单个 Blob? - How do I lease an individual blob in an Azure storage container using BlobLeaseClient? C#Azure存储-如何将文件上传到已经存在的容器 - C# Azure Storage - How to Upload a File to an already Existing Container 如何读取存储在 Azure 存储中的 Excel 文件作为 Blob 文件 - How to read an excel file stored in Azure Storage as a Blob File
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM