How to convert blob to URL in ReactNative
P粉659518294
2023-08-10 15:38:09
<p>In my ReactNative application, I'm having trouble downloading files</p>
<p>Backend response:</p>
<p><code>{"_data": {"__collector": {}, "blobId": "E582A159-8E6E-48D2-B245-CA62A7005706", "name": "v1-download-proforma-invoice. json", "offset": 0, "size": 108769, "type": "application/json"}}</code></p>
<p>I need to download this blob file to the device</p>
<p>Looks like I need a data URL to download the file to my device</p>
<p>How to generate this URL from this response in ReactNative? </p>
<p>I use useMutation hook in react-query to handle this operation</p>
To download data, you can use
useQuery
and provide the attributeonSuccess
: