How can i reads a text blob in Azure without downloading it? I am able to download the file and then read it but, i prefer it to be read without downloading.
JavaScript
x
5
1
print("nList blobs in the container")
2
generator = block_blob_service.list_blobs(container_name)
3
for blob1 in generator:
4
print("t Blob name: " + blob.name)
5
Is there any operation in ‘blob1’ object, which would allow me to read the text file directly.(like blob1.read or blob1.text or something like this)?
Advertisement
Answer
You can use get_blob_to_text
method.
JavaScript
1
5
1
block_blob_service = BlockBlobService(account_name='myaccount', account_key='mykey')
2
3
blob = block_blob_service.get_blob_to_text('mycontainer', 'myblockblob')
4
print(blob.content)
5