Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

React Native Expo - Directory for 'file:///xxx' doesn't exist when using downloadResumable.downloadAsync()

$
0
0

Before is my code to download file in the RN fileSystem

import * as FileSystem from 'expo-file-system';...const callback = () => {...}const url = 'http://techslides.com/demos/sample-videos/small.mp4';const outputDir = `${FileSystem.documentDirectory}${'some-title'}.mp4`;const downloadResumable = FileSystem.createDownloadResumable(url, outputDir, {}, callback);try {  const { uri } = await downloadResumable.downloadAsync();  console.log('Finished downloading to ', uri);} catch (e) {  console.error(e);}

The error appears as below

Directory for 'file:///Users/CCCC/Library/Developer/CoreSimulator/Devices/E87E063B-79E8-41BF-A577-AA49182563DF/data/Containers/Data/Application/F5DDDD75-D189-48E6-8147-A34CFBD2F3E9/Documents/ExponentExperienceData/%40anonymous%2Freact-native-app-f9653fe1-4d31-4314-a801-d0d158dd59b1/eob/88000954-101-246844-29062022165701.pdf.pdf' doesn't exist. Please make sure directory '/Users/CCCC/Library/Developer/CoreSimulator/Devices/E87E063B-79E8-41BF-A577-AA49182563DF/data/Containers/Data/Application/F5DDDD75-D189-48E6-8147-A34CFBD2F3E9/Documents/ExponentExperienceData/%40anonymous%2Freact-native-app-f9653fe1-4d31-4314-a801-d0d158dd59b1/eob' exists before calling downloadAsync.at node_modules/react-native/Libraries/BatchedBridge/NativeModules.js:104:50 in promiseMethodWrapperat node_modules/expo-modules-core/build/NativeModulesProxy.native.js:15:23 in moduleName.methodInfo.nameat node_modules/expo-file-system/build/FileSystem.js:240:21 in DownloadResumable#downloadAsyncat http://192.168.1.97:19000/index.bundle?platform=ios&dev=true&hot=false&strict=false&minify=false:320670:16 in Promiseat node_modules/expo-file-system/build/FileSystem.js:232:4 in DownloadResumable#downloadAsync...

How can I fix it?


Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>