question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to share custom text file types (IGC)?

See original GitHub issue

Hi! 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: Screen Shot 2020-06-20 at 11 53 02

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: Screen Shot 2020-06-20 at 12 01 45

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:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:7

github_iconTop GitHub Comments

2reactions
perfectencommented, Aug 20, 2020

@enesozturk Thank you very much.

1reaction
perfectencommented, Aug 23, 2020

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to share custom text file types (IGC)? · Issue #807 - GitHub
I am using this lib to share my local or remote files. I can share files both Android ... How to share custom...
Read more >
React Native share file with custom extension - Stack Overflow
IGC extension. It is a text file actually. I am trying to share this files with react-native-share package. In iOS it is fine....
Read more >
Sharing custom file types in iOS - Artur Gruchała
Add plain file to project and give it name: fileToShare.shr . Fill the file with some text, it can be anything you want....
Read more >
Importing data to the IBM i platform when the from-file is a ...
If the file has one field, the data type must be CHARACTER, IGC OPEN, IGC EITHER, IGC ONLY, or GRAPHIC, either in fixed...
Read more >
List of file formats - Wikipedia
This is a list of file formats used by computers, organized by type. ... Some file formats, such as .txt or .text ,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found