Issue: Error in ios: Cannot read property 'RNFSFileTypeRegular' of undefined

its also an issue in the react-native-fs repo Error in ios: Cannot read property 'RNFSFileTypeRegular' of undefined · Issue #299 · itinance/react-native-fs · GitHub

Are you trying to use react-native-fs or a package that depends on react-native-fs? That package defines RNFSFileTypeRegular in native code that Expo doesn’t include.

In the upcoming SDK 19 or 20 we are planning on adding a filesystem API to the Expo SDK that you can use for native FS access. That should hopefully remove the need to use react-native-fs for you and fix your problem.

Thank you for your reply. I just want to import RNFS like this const RNFS = require(‘react-native-fs’); and got that error.
So can you kindly suggest me how to download file from an url while using EXPO.

Thanks in advance.

Could you explain what kind of file you’re downloading and what you want to do with it?

just a zip file with following url .
I need to download in into documendirectory path and unzip it.

I’m not sure that use case is well supported right now. There are some internal Expo APIs to download files to disk but you’d need a way to unzip it.


I know you said

We’re at SDK 25 at the time of writing and I need to get a non-image file, PDF/Word/Excel file from an iPhone storage that I got from the uri for from the DocumentPicker as a base64 string.

Or is there some other functionality from the DocumentPicker that I’m not aware of that can return it as base64? e.g. ImagePicker’s option to return base64. { base64: true }

Otherwise I’ll have to detach and use RNFS.


If there’s no base64 option listed in the docs, we don’t support it. But perhaps you could use the FileSystem API readAsStringAsync for some file formats, or upload them to a server using FormData + fetch, depending on your use case.

This topic was automatically closed after 14 days. New replies are no longer allowed.