How to share custom text file types (IGC)?
See original GitHub issueHi! Thanks for provide such a good library. I am using this lib to share my local or remote files. I can share files both Android and iOS. But in Android, I need to convert my files to base64. So far so good. But when I try to share my base64 coded file, lib adds different file extension to my file. Here is info about my files;
My files are flight record file that has to be .IGC extension (just string inside). I create my record like file_name.IGC. When I try to share it in Android;
Example 1
File Name: ‘2020-06-20-11-51-28-FNMN.IGC’ Converting to base 64 (data:text/plain)
await RNFS.readFile(fileURLToShare, 'base64').then(res => {
fileURLToShare = `data:text/plain;base64,${res}`;
});
Share Options
Share.open({
url: fileURLToShare,
email: user.email,
filename: fileName,
showAppsToView: true,
type: 'other',
title: fileName,
})
Result:
Example 2
Converting to base 64 (data:text/igc)
await RNFS.readFile(fileURLToShare, 'base64').then(res => {
fileURLToShare = `data:text/igc;base64,${res}`;
});
Result: Same above
Example 3
file_name: ‘2020-06-20-11-51-28-FNMN’ (I created record file without any extension to try) Converting to base 64 (data:text/plain)
await RNFS.readFile(fileURLToShare, 'base64').then(res => {
fileURLToShare = `data:text/igc;base64,${res}`;
});
Result:
What should I do to share my record file with .igc extension? Thanks in advance
“react-native-share”: “3.3.2”, “react-native”: “0.61.4”,
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:7
@enesozturk Thank you very much.
I found a funy problem. the same file name can be share just once with a right extension. then the extension would be .null.
So I set the filename with HHMMSS,now the extension is ok.