react-native-file-type
react-native-file-type copied to clipboard
The parameter can only be file path
The argument must be file path. If there is only file uri, then it needs to be converted to path first.
import fileType from 'react-native-file-type';
import getPath from 'react-native-get-real-path';
// uri like: content://com.android.providers.media.documents/document/audio:43
const stat = await getPath.getRealPathFromURI(uri)
.then(path => fileType(path));