Кеш, документы, загрузки, спец.дира.
const {dirs} = RNFetchBlob.fs;
const nameWithFormatString = fileName + '.pdf';
const dirToSave = Platform.OS === 'ios' ? dirs.DocumentDir : dirs.DownloadDir;
const path = `${dirToSave}/${nameWithFormatString}`;
const configfb = {
path: path,
fileCache: true,
notification: true,
addAndroidDownloads: {
useDownloadManager: true,
sound: true,
notification: true,
path: path,
title: nameWithFormatString,
mime: 'application/pdf',
description: fileName,
},
};
const configOptions = Platform.select({
ios: {
fileCache: configfb.fileCache,
title: configfb.title,
path: configfb.path,
appendExt: 'pdf',
mime: 'application/pdf',
},
android: configfb,
});
try {
await RNFetchBlob.config(configOptions)
.fetch('GET', `${getBaseUrl()}/transcriptes/file`, {
Authorization: getBearerApiToken(),
'Content-Type': 'application/pdf',
})