Reputation: 1916
That's how I upload to azure page blob storage
var memoryStream = new MemoryStream(range, offsetToTransfer, sizeToTransfer, false, false);
pageBlob.WritePages(memoryStream, vhdOffset + offsetToTransfer, null);
Console.WriteLine("Range ~" + Megabytes(offsetToTransfer + vhdOffset) + " + " + PrintSize(sizeToTransfer));`
Azure recommend me to use this library to upload etc.
How can I set second parameter (it's offset) vhdOffset + offsetToTransfer
to UploadAsync
? I mean how can I specify a position
where I want to write?
var memoryStream = new MemoryStream(range, offsetToTransfer, sizeToTransfer, false, false);
TransferManager.UploadAsync(memoryStream, pageBlob);
Upvotes: 0
Views: 800
Reputation: 199
If you wish to write a page with an offset, you may use the CloudPageBlob.WritePagesAsync API wich is documented here. https://msdn.microsoft.com/en-us/library/microsoft.windowsazure.storage.blob.cloudpageblob.writepagesasync(v=azure.10).aspx
There a complete sample based on CloudPageBlob.WritePages API here.
The following code :
MemoryStream memoryStream = new MemoryStream(range,
offsetToTransfer, sizeToTransfer, false, false);
pageBlob.WritePages(memoryStream, vhdOffset + offsetToTransfer);
allows you to write a sequential set of pages up to 4MBs, and the offset being written to must start on a 512 byte boundary (startingOffset % 512 == 0), and end on a 512 boundary – 1.
Hope this helps
Best regards
Stéphane
Upvotes: 1