itinance / itinance/react-native-fs
Read/write extremely slow on IOS
- Dominant language
- C++
- Stars
- 5k
- Forks
- 1k
- PR merge metrics
- No merged PRs in 30d
Description
I'm writing a 5mo json in a file with utf8 encoding.
1. 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.
2. i get empty return when using base64 option on Ios only
3. 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 ?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.