react-native-get-real-path | Convert file uri to real path | AWS library
kandi X-RAY | react-native-get-real-path Summary
kandi X-RAY | react-native-get-real-path Summary
Convert file uri to real path
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Get the actual path from a URI
- Get media column
- Write file to temporary file
- Generates a random string
- Creates the error payload
- Checks if the given URI is a download document
- Checks if the given URI is an external storage document
- Replies if the given URI is a media document
- Create native modules
- Creates a list of JavaScript modules
- Create the view managers
react-native-get-real-path Key Features
react-native-get-real-path Examples and Code Snippets
Community Discussions
Trending Discussions on react-native-get-real-path
QUESTION
I use react-native-document-picker to select images and videos in Android and IOS. The problem is that it returns an uri, and I need the real path.
I tried using react-native-fetch-blob with function stat. And react-native-fs with function stat. Both don't work with uris. But if I use for example react-native-fs readFile, it works ok with uris.
react-native-get-real-path works only with Android so is not an option.
EDIT: Someone advised me to use rn-fetch-blob, but I had problems installing it: https://github.com/joltup/rn-fetch-blob/issues/289
I tried to use react-native-get-real-path and distinguish between Android and IOS, but it is problematic too.
...ANSWER
Answered 2019-Dec-03 at 07:51Finally I used react-native-document-picker for ios and react-native-file-picker for android
QUESTION
I've been trying to make a simple document picker that allows the user to select a file and returns the selected file encoded in base64. For that, I'm currently using two packages :
- react-native-document-picker, which allows the user to pick a file and returns a content uri
- react-native-fs, for its readFile function that takes an uri in parameter and returns the file in base64
Here is this specific bit of code :
...ANSWER
Answered 2019-Feb-20 at 14:43Answering my question since I found the problem : RNFS.readFile only works when supplied the original res.uri, you don't have to decode it via decodeURIComponent.
The correct code was :
QUESTION
React Native [Android]
Samsung Phone
Libraries :
- react-native-document-picker [ returns our URI]
- react-native-get-real-path [ converts URI to real path]
Able to :
- Get a URI from local files and get real path including images
- Able to get URI from Google Drive when I select a file
Unable :
Convert Google Drive URI to real path
...
ANSWER
Answered 2018-Sep-15 at 05:48Fixed bug to get absolute path of Google Drive File.
So it turns out that we cannot directly get the absolute path from the URI
that has been returned by selecting Google Drive File. Hence we need to apply some sort of hack to solve the problem.
What I did was, I forked the react-native-get-real-path
repo into our own and then changed few things in GRP.java
file.
I basically created InputStream
from obtained google drive file's URI
and then, using that stream, copied the file into the app's cache directory and returned the absolute path to that file and voila.
Here is the code snippet for the solution:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install react-native-get-real-path
android/settings.gradle
android/app/build.gradle
register module (in MainActivity.java) For react-native below 0.19.0 (use cat ./node_modules/react-native/package.json | grep version)
For react-native 0.19.0 and higher
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page