Open
Description
I'm writing a 5mo json in a file with utf8 encoding.
- it's very slow on IOS
it take +-50ms with android
it take +-6000ms with ios iphone 5
reading the file take
250ms with android
13000ms with ios.
-
i get empty return when using base64 option on Ios only
-
my code :
var RNFS = require('react-native-fs'); const rootPath = RNFS.DocumentDirectoryPath; //= (os == "android") ? RNFS.DocumentDirectoryPath :RNFS.MainBundlePath export function writeFile(filename, content) { var path = rootPath + '/' + filename; return RNFS.writeFile(path, content, 'base64').then(() => { console.log('FILE WRITTEN!'); return true; }).catch((err) => { console.log(err.message); return false; }); } export async function readFile(filename) { var path = rootPath + '/' + filename; var content = await RNFS.readFile(path, 'base64'); console.log("content before return", content ); return content; }
and how i made the calls
async readFile() {
const content = await tools.readFile("en-test.js");
console.log("content", content);
}
async writeFile() {
const res = await tools.writeFile(
"en-test.js",
'Lorem ipsum dolor sit ametLorem ipsum dolor sit ametLorem ipsum dolor sit ametLorem ipsum dolor'
);
console.log("res", res);
}
I need to keep utf8, any advice ?