itinance / itinance/react-native-fs

RNFS.writeFile or RNFS.copyFile error 'Out of Memory'

Open
#853 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
5k
Forks
1k
PR merge metrics
No merged PRs in 30d

Description

### Out of memory error when writing big files say 50Mb -100Mb on Android.

```
//const base64Data is read from "RNFS.readFile(item.uri, 'base64')" function...

const isPlatformAndroid = (Platform.OS === 'android');
const folder = isPlatformAndroid ?"RNFS.ExternalStorageDirectoryPath/"+appName+"/Vids/" : "RNFS.DocumentDirectoryPath/"+appName+"/Vids/";
const fileName = new Date().getTime() + .mp4;
const file_path_ = isPlatformAndroid ? "file://+"folder"+"fileName" : "file://+"folder"+"fileName";

// write the file with options 'base64'
RNFS.writeFile(file_path_, base64Data, 'base64')
.then(() => {})
.catch(error => console.log(error.message));
```
---------------------------------------------------

React Native Environment Info:
System:
OS: macOS 10.14.4
CPU: (4) x64 Intel(R) Core(TM) i5-7400 CPU @ 3.00GHz
Memory: 777.91 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 10.12.0 - /usr/local/bin/node
npm: 6.4.1 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
Android SDK:
API Levels: 21, 22, 23, 24, 25, 27, 28
Build Tools: 23.0.1, 23.0.3, 27.0.3, 28.0.0, 28.0.3, 29.0.0
System Images: android-22 | Google APIs Intel x86 Atom, android-23 | Google APIs Intel x86 Atom, android-28 | Google APIs Intel x86 Atom
IDEs:
Android Studio: 3.3 AI-182.5107.16.33.5314842
Xcode: 10.2/10E125 - /usr/bin/xcodebuild
npmPackages:
react: 16.6.3 => 16.6.3
react-native: ^0.59.10 => 0.59.10

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.