-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
writeFile doesn't work properly with ciphered data #82
Comments
When reading/writing the data, are you using |
With react-native-fs I used 'utf8' (your lib works the same, if you don't pass any encoding, it'll be utf8). Any opportunity to not "truncates on the first null character in the binary data"? As I see it truncates after '§' symbol. |
It looks like The way React Native passes strings between JS and native code is unsafe for binary data (strings containing null characters). The workaround for this is to base 64 encode the data for the round trip. In this library, I avoided the automatic internal conversions, since it is a performance cost that might not be need if the app is only working with text data. Instead, the app explicitly chooses when to pay the extra cost of base 64 encoding/decoding. |
react-native: 0.73.6
react-native-file-access: 3.0.7
Platform: Android
Bug
I use node-forge to cipher my data. When I try to writeFile, it doesn't write all cipheredBytes. For example, there are 2 cases, when I try to readFile that was written by react-native-file-access (1 photo) and by react-native-fs (2 photo). Of course after that I can't properly decipher it when I want to see my image. Any ideas why it's happening?
Details
The text was updated successfully, but these errors were encountered: