react-native-actual-path
January 11, 2025 ยท View on GitHub
A utility package to resolve real file paths from content:// URIs on Android in React Native.
This package is designed to help developers convert content:// URIs, commonly used by Android content providers, into actual file system paths. It's particularly useful for accessing files in the device's storage from React Native apps.
Installation
You can install the package using either npm or yarn:
npm install react-native-actual-path
# or
yarn add react-native-actual-path
Key Features:
- ๐ Android Only
- โก Lightweight Library
- ๐ Supports New Architectures (Turbo Modules)
Example:
import { getRealPath } from 'react-native-real-path';
import { pickSingle } from 'react-native-document-picker';
const result = await pickSingle();
const realPath = getRealPath(result.uri);
console.log(realPath); // Output: actual file system path or original URI
getRealPath(path: string): string
- Input: A string representing a file path or URI.
- Output: A string representing the real file system path if the input is a
content://URI, or the original path if not.