After looking at this tutorial on blobs: channel 9, I was thinking of using a blob container to save a bunch of tweets (storing the json of each tweet that is). Ideally I would like to create a blob reference for each hour of the day, and append new tweets to this blob as they come in. The issue is that the method UploadText(string) overwrites the existing content of the blob, is there an easy way to append text to an existing blob ?
Thanks!
fun (json:string) ->
let account = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("DataConnectionString"))
let blobs = account.CreateCloudBlobClient();
let tempBlob = blobs.GetBlobReference("tweets/2010-9-26/17/201092617.txt")
tempBlob.Properties.ContentType <- "text/plain"
tempBlob.UploadText(json)
Azure now supports Append Blobs. When you create a new blob, you must define it as an Append Block. You can't append to existing block blobs.
Here's some simple code which you can use.
Append:
CloudAppendBlob appendBlob = container.GetAppendBlobReference("myblob.txt")
appendBlob.AppendText("new line");
Read:
appendBlob.DownloadText()
Technet contains a good tutorial on the subject. Also the official Azure documentation now includes help for using Append Blob.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With