I want to connect to azure blob storage via my React-Native Application.
I am getting this error: [Error: Account connection string is only supported in Node.js environment]
Does this mean that I cannot connect to Azure using connection string in react-native application?
Please provide alternatives to do so.
import { BlobServiceClient} from "@azure/storage-blob"; const downloadfirmwareFile=async()=>{ try{ const blobServiceClient=BlobServiceClient.fromConnectionString(azureConnectionString) const containerClient=blobServiceClient.getContainerClient(azureContainerName) const blobClient=containerClient.getBlobClient({filepath}) //exact location where the file is stored const downloadedBlobResponse= await blobClient.download(0) const downloadedBlob= await downloadedBlobResponse.blobBody if(!downloadedBlob){ console.log("Blob data is undefined") return; } else{ const arrayBuffer= await downloadedBlob.arrayBuffer() const binaryData= Buffer.from(arrayBuffer).toString() const filePath=
${RNFS.DocumentDirectoryPath}/downloaded-file.bin await RNFS.writeFile(filePath,binaryData,'binary') console.log("file created") } } catch(error){ console.log(error) } }
I expected this code in react-native to connect with azure blob storage and download the file from there but unfortunately does not do that.
Freyal Shah is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.