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

#1

its also an issue in the react-native-fs repo https://github.com/itinance/react-native-fs/issues/299

#2

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.

#3

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.

#4

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

#5

just a zip file with following url http://85.17.76.181/~offisersbladet/resources/uploads/releases/zipfiles/1498472033.zip .
I need to download in into documendirectory path and unzip it.

#6

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.

#7

@ide

Hi,
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.

Thanks.

#8

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.

closed #9

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