forked from npomfret/react-native-cloud-fs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
47 lines (41 loc) · 1.4 KB
/
index.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
37
38
39
40
41
42
43
44
45
46
47
'use strict';
import RNCloudFs from './RNCloudFs';
// Wrapper so we have identical implementation
/**
* @class
*/
class RNCloudFsWrapper {
/**
* List files on cloud drive
* @param {string} targetPath Relative path on cloud drive
* @param {string} scope Scope: visible or hidden
* @returns {Promise<boolean>}
*/
static fileExists({targetPath, scope}) {
return RNCloudFs.fileExists({targetPath, scope});
}
/**
* Copy file to cloud drive
* @param {SourcePath} sourcePath Local source path (uri or path)
* @param {string} targetPath Relative destination path on the cloud drive
* @param {string} mimeType Mime type the file is stored under
* @param {string} scope File scope (visible or hidden)
* @returns {Promise<string>} Actual cloud path where the file was stored (in case file already existed)
*/
static copyToCloud({sourcePath, targetPath, mimeType, scope}) {
return RNCloudFs.copyToCloud({sourcePath, targetPath, mimeType, scope});
}
/**
* List files on cloud drive
* @param {string} targetPath Relative path on cloud drive
* @param {string} scope Scope: visible or hidden
* @returns {Promise<FileList>}
*/
static listFiles({targetPath, scope}) {
return RNCloudFs.listFiles({targetPath, scope});
}
static get accessToken() {
return RNCloudFs.accessToken;
}
}
export default RNCloudFsWrapper;