please provide the version of installed library and RN project.
"rn-fetch-blob": "0.12.0",
a sample code snippet/repository is very helpful to spotting the problem.
// in this case filePath was derived from react-native-image-picker and is the default images provided by ios simulator
const filePath = '/Users/me/Library/Developer/CoreSimulator/Devices/D266C4/data/Containers/Data/Application/6D3A9/tmp/F2D4E641-5AD7-4857-B17C-8AC9716A8A35.jpg'
const destPath = `${RNFetchBlob.fs.dirs.CacheDir}/a/b.jpg`; // doesn't work
// const destPath = `${RNFetchBlob.fs.dirs.CacheDir}/b.jpg`; // does work
RNFetchBlob.fs.cp(filePath, destPath);
// also, this is true:
const exists = await RNFetchBlob.fs.exists(filePath);
Running this code will produce the error:
[Error: The file “F2D4E641-5AD7-4857-B17C-8AC9716A8A35.jpg” doesn’t exist.]
This, like cp in bash, will fail when the directory you're copying into doesn't exist. It took me quite a while to realize that, because the error message sent me down a different rabbit hole of trying to understand why my source file was missing (despite fs.exists telling it does exist).
Instead I would expect the error to be Directory "a" doesn't exist or perhaps Failed to cp "b.jpg"
please provide the version of installed library and RN project.
a sample code snippet/repository is very helpful to spotting the problem.
Running this code will produce the error:
[Error: The file “F2D4E641-5AD7-4857-B17C-8AC9716A8A35.jpg” doesn’t exist.]
This, like
cp
in bash, will fail when the directory you're copying into doesn't exist. It took me quite a while to realize that, because the error message sent me down a different rabbit hole of trying to understand why my source file was missing (despitefs.exists
telling it does exist).Instead I would expect the error to be
Directory "a" doesn't exist
or perhapsFailed to cp "b.jpg"