React-native-fs: Error when reading large file on Android

Created on 16 Dec 2018  ·  11Comments  ·  Source: itinance/react-native-fs

I am trying to read 2xxmb crypt12 file from FS.
When I trying to run await RNFS.readFile(${RNFS.ExternalStorageDirectoryPath}/Whatsapp/Databases/msgstore.db.crypt12), it prompts up

Could not invoke RNFSManager.readFile

null

Failed to allocate a 536870928 byte allocation with 25165824 free bytes and 248MB until OOM, max allowed footprint 301365936, growth limit 536870912

I have already set android:hardwareAccelerated="false" and android:largeHeap="true" in AndroidManifest.xml but no luck.

How can I solve it? Thank you

question

All 11 comments

Well, such things happen when you are blowing your devices memory with such a big file. It was never a good practice to load a file completely into memory. You should treat this instead on a chunk-by-chunk basis.
Best thing here would be to find a library, that is capable of decrypting the crypt12-file. Then you can load this database (assuming it is Sqlite3 based) with react-native-sqlite-storage to dig trough the data.

There is little chance, that whatsapp is using sqlite-cipher for encyrption (DYOR pls). Then this issue should give you help: https://github.com/craftzdog/react-native-sqlite-2/issues/32

same issue, I tried to upload 30 sec video

同样的问题,我尝试上传30秒的视频

Did you solve this problem later

same issue, I tried to upload 30 sec video

Did you solve this problem later

I have tried rn-fetch-blob library instead and it work for me

I have tried rn-fetch-blob library instead and it work for me

RNFetchBlob.fs.readStream?

no
const data = RNFetchBlob.wrap(localPath)
RNFetchBlob.fetch('POST', url, { 'Content-Type': 'multipart/form-data' }, [
{ name: 'file', filename: 'test', data, type: this.mediaMimeType }
])
but I have found that it's slower than send data in base64. So I still looking for faster solution

Hi,
Any update about this issue? I have the same issue.

Same issue

I am having the same issue any solution??

Same here

Same here

Was this page helpful?
0 / 5 - 0 ratings