@@ -22,44 +22,14 @@ import type {
2222
2323const RNFetchBlob :RNFetchBlobNative = NativeModules . RNFetchBlob
2424const emitter = DeviceEventEmitter
25-
26- // session table
27- let sessions = { }
28-
29- /**
30- * Get path of system directories.
31- * @return {object } Map contains DocumentDir, CacheDir, DCIMDir, DownloadDir,
32- * , some directory might not be supported by platform.
33- */
34- function getSystemDirs ( ) {
35- return new Promise ( ( resolve , reject ) => {
36- try {
37- RNFetchBlob . getEnvironmentDirs ( ( ...dirs ) => {
38- let [
39- DocumentDir ,
40- CacheDir ,
41- // Android only
42- DCIMDir ,
43- DownloadDir ,
44- PictureDir ,
45- MusicDir ,
46- MovieDir ,
47- RingToneDir ] = [ ...dirs ]
48- resolve ( {
49- DocumentDir,
50- CacheDir,
51- DCIMDir,
52- DownloadDir,
53- PictureDir,
54- MusicDir,
55- MovieDir,
56- RingToneDir
57- } )
58- } )
59- } catch ( err ) {
60- reject ( err )
61- }
62- } )
25+ const dirs = {
26+ DocumentDir : RNFetchBlob . DocumentDir ,
27+ CacheDir : RNFetchBlob . CacheDir ,
28+ PictureDir : RNFetchBlob . PictureDir ,
29+ MusicDir : RNFetchBlob . MusicDir ,
30+ MovieDir : RNFetchBlob . MovieDir ,
31+ DownloadDir : RNFetchBlob . DownloadDir ,
32+ DCIMDir : RNFetchBlob . DCIMDir
6333}
6434
6535/**
@@ -289,7 +259,6 @@ export default {
289259 session,
290260 ls,
291261 readStream,
292- getSystemDirs,
293262 mv,
294263 cp,
295264 writeStream,
@@ -298,5 +267,6 @@ export default {
298267 isDir,
299268 stat,
300269 lstat,
301- scanFile
270+ scanFile,
271+ dirs
302272}
0 commit comments