简体   繁体   中英

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. 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.

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

You obviously need to implement your own GetCloudBlockBlob() method.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM