如何从base64字符串以本机方式下载文件?

时间:2019-03-07 10:36:18

标签: file react-native download base64

我尝试了以下代码下载文件。它运行良好。但是我有一个base64格式的文件。那我怎么下载呢?

const { config, fs } = RNFetchBlob;
let PictureDir = fs.dirs.PictureDir; // this is the pictures directory. You can check the available directories in the wiki.
let options = {
  fileCache: true,
  addAndroidDownloads: {
    useDownloadManager: true, // setting it to true will use the device's native download manager and will be shown in the notification bar.
    notification: true,
    path: PictureDir + '/Testing.pdf', // this is the path where your downloaded file will live in
    description: 'Downloading image.'
  }
};
config(options).fetch('GET', 'http://www.africau.edu/images/default/sample.pdf').then((res) => {
  console.warn(res);
  alert('HIIII');
});

0 个答案:

没有答案