Reputation: 1508
Below i have function with an external which calculate blob container size
function getBlobContainerSize(container, callback) {
storageClient.listBlobsSegmented(container, null, null, function(error, result) {
var length=0,counter=result.entries.length;
for (var i = 0; i < result.entries.length; i++) {
getBlobSize(container, result.entries[i].name, function(size){
length+=size;
if(--counter===0) callback(length);
});
};
});
}
function getBlobSize(container, blob, callback){
storageClient.getBlobProperties(container, blob, function(err, result, response) {
if(result==null) callback(0);
else callback(parseInt(result.contentLength));
});
}
And the result is for an specific container 20907510, and in the Azure Storage Explorer i see 84.03M. Correct me if i am wrong but this two is different by 64mb, Azure Storage Explorer show much more mb in compare with my function.
Upvotes: 0
Views: 1560
Reputation: 101
Considering you're using standard storage, the method you're using to calculate the size of container, may not be the size which Azure Storage bills you for. For page and block blobs in standard storage, Azure storage bills for the data stored. More detailed information can be found here: http://blogs.msdn.com/b/windowsazurestorage/archive/2010/07/09/understanding-windows-azure-storage-billing-bandwidth-transactions-and-capacity.aspx
Your method will give you the sum of content lengths of all the blobs in your container. Azure-Storage might still be billing you for less.
Upvotes: 1