forked from joltup/rn-fetch-blob
-
Notifications
You must be signed in to change notification settings - Fork 134
/
mediacollection.js
36 lines (29 loc) · 1.14 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
34
35
36
import type {ReactNativeBlobUtilNative, filedescriptor} from "./types";
import ReactNativeBlobUtil from "./codegenSpecs/NativeBlobUtils";
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, false);
}
function writeToMediafileWithTransform(uri: string, path: string) {
return ReactNativeBlobUtil.writeToMediaFile(uri, path, true);
}
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,
writeToMediafileWithTransform,
copyToInternal,
getBlob,
copyToMediaStore
};