forked from RonRadtke/react-native-blob-util
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mediacollection.js
33 lines (26 loc) · 1.03 KB
/
mediacollection.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import {NativeModules} from 'react-native';
import type {ReactNativeBlobUtilNative, filedescriptor} from "types";
const ReactNativeBlobUtil: ReactNativeBlobUtilNative = NativeModules.ReactNativeBlobUtil;
function createMediafile(fd: filedescriptor, mediatype: string): Promise {
if ((!'parentFolder' in fd)) fd['parentFolder'] = '';
return ReactNativeBlobUtil.createMediaFile(fd, mediatype);
}
function writeToMediafile(uri: string, path: string) {
return ReactNativeBlobUtil.writeToMediaFile(uri, path);
}
function copyToInternal(contenturi: string, destpath: string) {
return ReactNativeBlobUtil.copyToInternal(contenturi, destpath);
}
function getBlob(contenturi: string, encoding: string) {
return ReactNativeBlobUtil.getBlob(contenturi, encoding);
}
function copyToMediaStore(fd: filedescriptor, mediatype: string, path: string) {
return ReactNativeBlobUtil.copyToMediaStore(fd, mediatype, path);
}
export default {
createMediafile,
writeToMediafile,
copyToInternal,
getBlob,
copyToMediaStore
};