iOS : Error with stat with path returned by RNDocumentPicker
See original GitHub issueI’m having trouble with stat on iOS:
Error: failed to stat path
file:///private/var/mobile/Containers/Data/Application/75F278D1-A1BB-4E75-8C98-E95FC7DC86E2/tmp/com.sensoriaanalytics.CardioSensys-Inbox/Olivier__50yo_NaNcm_2019_11_24_10h_50m_26s.csv because it does not exist or it is not a folder
With a path returned by RBDocumentPicker on iOS.
I’m using: “react-native-document-picker”: “^3.2.4”, “rn-fetch-blob”: “^0.10.15”,
Here is the code:
DocumentPicker.pick({
type: [DocumentPicker.types.csv]
})
.then(res => {
var file;
// if (RX.Platform.getType() === "android") {
RNFetchBlob.fs.stat(res.uri).then(stats => {
file = {
uri: "file://" + stats.path,
type: res.type,
name: res.name
};
logging.logWithTimestamp(
`Path [${file.uri}] MimeType [${file.type}] Name [${file.name}] Size [${res.size}]`
);
I would say that the file path returned by the picker is invalid but this seems strange.
Any help appreciated.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5
Top Results From Across the Web
Path for resource returns nil file path despite file is in ...
I see a nil value for the pathFor variable. However, if I contextually check the file existence in my app Bundle (using XCode...
Read more >contentsOfDirectoryAtPath:error - Apple Developer
Performs a shallow search of the specified directory and returns the paths of any contained items. iOS 2.0+ iPadOS 2.0+ macOS 10.5+ Mac...
Read more >react-native-document-picker - Bountysource
On iOS 13 the UIDocumentPickerViewController appears fine, I can navigate through folders OK but when I tap on a particular file nothing happens....
Read more >Top 5 react-native-fs Code Examples - Snyk
writeFile(path, xmlString, 'utf8'); //using console.log output is not shown in ... stat the first file return Promise.all([RNFS.stat(result[0].path), ...
Read more >react-native-fs - npm
Start using react-native-fs in your project by running `npm i ... return Promise.all([RNFS.stat(result[0].path), result[0].path]);.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Solved the problem by removing “file:///private” from the beginning of The Uri returned by RNDocumentPicker.
I have no idea other than my proposed workaround above.