title: React Native: download PDF to local storage (ios)
body: <p>I have the following function to download a PDF from my server:</p>
  <pre><code>  const downloadInvoice = (invoiceId) =&gt; {
      const path = `${RNFetchBlob.fs.dirs.DocumentDir}/${invoiceId}.pdf`;
      RNFetchBlob.config({
        fileCache: true,
        path,
      }).fetch('GET', `${Urls.base}/pro/invoice?invoiceId=${invoiceId}`, {
        ...authorizationHeaders
      }).then((response) =&gt; {
        RNFetchBlob.ios.openDocument(path);
      }).catch((error) =&gt; {
        Alert.alert(error);
      });
    };
  </code></pre>
  <p>When I run this code, the document opens up on my iPhone and I can see the PDF file. The problem is, I cant find the PDF document anywhere after I close the window. It seems like the document is stored in cache, but I want it to store in a folder accessible on my iPhone for later user (or to print it or transfer it to my laptop).</p>
  <p>Path looks like: <code>/var/mobile/Containers/Data/Application/AD1F85AC-456F-321A-A4B2-1B248F1134C1/Documents/20-02-2020-01-02.pdf</code>. Also, when I console.log response.path(), it has the same path.</p>
  <p>I'm using <a href="https://github.com/joltup/rn-fetch-blob" rel="nofollow noreferrer">rn-fetch-blod</a>, but I see this package is unmaintained. If somebody has a good alternative, I'm happy to hear it.</p>