How to use azure iOS-sdk for downloading file in multipart from blob storage ?

Udayaditya Sasmal 20 Reputation points
2023-04-18T12:00:29.8266667+00:00

Hello,
In current version of azure-ios-sdk I found that multipart file download is not working properly.

I've found this method in this sdk for range based download.

download(to: OutputStream, range: NSRange, accessCondition:AZSAccessCondition, requestOptions: AZSBlobRequestOptions operationContext: AZSOperationContext, completionHandler: (Error?) -> Void)

Here is the code snippet.


let fileName = blob.storageUri.primaryUri.lastPathComponent
guard let blockBlob: AZSCloudBlockBlob = self.blobContainer?.blockBlobReference(fromName: fileName) else { return }
guard let directory = FileManager.default.urls(for: .cachesDirectory, in: .userDomainMask).first else { return }
        
let outPutStream = OutputStream(url: directory, append: false)
var offset = 0
var range = NSRange(location: offset, length: blob.properties.length as! Int)
        
outPutStream?.open()
blockBlob.download(to: outPutStream, range: range, accessCondition: nil, requestOptions: nil, operationContext: nil) { error in
     if(error != nil){
        print("Error: \(error)")
     }
}

But it seems not working.
Please correct me if I'm implementing it in a wrong way.

Azure Storage Accounts
Azure Storage Accounts
Globally unique resources that provide access to data management services and serve as the parent namespace for the services.
3,515 questions
Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
3,177 questions
0 comments No comments
{count} votes

Accepted answer
  1. Sumarigo-MSFT 47,466 Reputation points Microsoft Employee Moderator
    2023-04-20T10:12:45.59+00:00

    @Udayaditya Sasmal This Azure Storage Client Library for IOS is deprecated and not currently maintained. More Info here: https://github.com/Azure/azure-storage-ios

      As per the above documentation, If you want to download a blob's contents to a stream, this is possible using the DownloadToStream method on AZSCloudBlob. However, it is not yet possible to open an input stream that reads directly from the blob. This was mentioned under the Missing Functionality section. 
    Missing functionality The following functionality is all coming soon:

    • If you want to download a blob's contents to a stream, this is possible using the DownloadToStream method on AZSCloudBlob. However, it is not yet possible to open an input stream that reads directly from the blob.
    • There are a number of internal details that will change in the upcoming releases. If you look at the internals of the library (or fork it), be prepared. Much of this will be clean-up related. This project is not being actively maintained. Once a replacement is released, the link will be published here.

    Please let us know if you have any further queries. I’m happy to assist you further.

    Please do not forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.