getmedia(medianame) {
console.log(medianame);
path1 = RNFS.DocumentDirectoryPath + '/' + medianame;
console.log(path1);
axios({
method: 'POST',
url: 'https://content.dropboxapi.com/2/files/download',
headers: {
Authorization: 'Bearer JxxxxxxxxxxC7JnnYdLgKrxxyxyxyxyxyyxyxyxeeee',
'Dropbox-API-Arg': '{ "path": "/Apps/Myapp/+ medianame" }',
'Content-Type': 'text/plain',
Host: 'content.dropboxapi.com'
}
})
.then((response) => {
console.log(response);
RNFS.writeFile(path1, response, 'utf8')
.then((success) => {
console.log('FILE WRITTEN!');
})
.catch((err) => {
console.log(err.message);
});
});
}
I am using axios with post method to download an mp3 file from dropbox and ı write the response to the app folder but in app folder file seems to have 0 bytes, empty. What might be the problem?