0

I'm trying to download an mp3 file from a given URL, URL format is https://aaaa.net/?cmd=OG-translate&user=xxx&device_id=xxxx&input_text=Fine&lang=fr&output_file=151.20200706103512.mp3&info=tts_mp3

I want to download the file specified by output_file parameter 151.20200706103512.mp3 and save it. I've seen few examples, where file download URL is of format http://www.example.com/example.pdf, using RNFetchBlob. You can see this.

I've also tried using fetch

fetch("https://aaaa.net/?cmd=OG-translate&user=xxx&device_id=xxxx&input_text=Fine&lang=fr&output_file=151.20200706103512.mp3&info=tts_mp3", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

But I get the blob data. enter image description here

In postman, I can save the file using send and download button with a GET request. How can I download this file in react-native app? So maybe I've to save this raw format in .mp3 file?

Shahrear Bin Amin
  • 1,075
  • 13
  • 31
  • Does this answer your question https://stackoverflow.com/questions/44546199/how-to-download-a-file-with-react-native? – 5eb Jul 18 '20 at 18:31
  • Here is an answer that should help https://stackoverflow.com/a/44546891/9204320 – Sneeker Jul 18 '20 at 22:19

0 Answers0