itinance / react-native-fs

Native filesystem access for react-native
MIT License
4.97k stars 986 forks source link

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

Open rajeevrocker7 opened 4 years ago

rajeevrocker7 commented 4 years ago

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

vladpuz commented 3 years ago

+1 :(

velevtzvetlin commented 2 years ago

+1

ngdinhkhoa120691 commented 2 years ago

T_T

sangeetagrover commented 2 years ago

+1

saadlatif75 commented 4 months ago

@rajeevrocker7 @velevtzvetlin @ngdinhkhoa120691 @rajeevrocker7 @vladpuz @sangeetagrover have you found any solution?