react-native-file-type icon indicating copy to clipboard operation
react-native-file-type copied to clipboard

The parameter can only be file path

Open Lizhooh opened this issue 7 years ago • 0 comments

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));

Lizhooh avatar Nov 04 '18 09:11 Lizhooh