const AccessAsync = await AsyncStorage.getItem('Access');
const ACCESS_TOKEN = AccessAsync;
const DESTINATION_PATH = `${RNFS.LibraryDirectoryPath}/Data.zip`;
try {
const response = await axios.post(
{
path: '/BnD_Data/', // Path to the folder you want to list files in
recursive: false, // Set to true if you want to list files recursively
},
{
headers: {
Authorization: `Bearer ${ACCESS_TOKEN}`, // Replace with your access token
'Content-Type': 'application/json',
},
}
);
if (response.status == 200) {
const filesInDropbox = []
response.data.entries.forEach(element => {
console.log(element.name)
filesInDropbox.push(element.name)
});
console.log(filesInDropbox)
const dataZipExists = filesInDropbox.includes("Data.zip");
if (dataZipExists) {
try {
const headers = {
Authorization: `Bearer ${ACCESS_TOKEN}`,
'Dropbox-API-Arg': JSON.stringify({
path: '/BnD_Data/Data.zip',
}),
'Content-Type': 'application/octet-stream'
};
const response = await RNFetchBlob.config({
path: DESTINATION_PATH,
}).fetch('POST', DOWNLOAD_URL, headers);
} catch (error) {
}
}
}
} catch (error) {
}
this is my code where i try to download file using api but in this issue is if i upload file and then i try to download then file is being download but when second time i try to download file then getting error continuously until i re upload the same file and then download "error: [Error: The operation couldn’t be completed. Protocol error] " what's this issue