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));
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?