Browse Source

Update README.md

wkh237 8 years ago
parent
commit
b9801ce71f
1 changed files with 20 additions and 21 deletions
  1. 20
    21
      README.md

+ 20
- 21
README.md View File

146
 If you prefer a specific path rather than random generated one, you can use `path` option. We've added a [getSystemDirs](#user-content-getsysdirs) API in v0.5.0 that lists several common used directories.
146
 If you prefer a specific path rather than random generated one, you can use `path` option. We've added a [getSystemDirs](#user-content-getsysdirs) API in v0.5.0 that lists several common used directories.
147
 
147
 
148
 ```js
148
 ```js
149
-RNFetchBlob.getSystemDirs().then((dirs) => {
150
-  RNFetchBlob
151
-    .config({
152
-      // response data will be saved to this path if it has access right.
153
-      path : dirs.DocumentDir + '/path-to-file.anything'
154
-    })
155
-    .fetch('GET', 'http://www.example.com/file/example.zip', {
156
-      //some headers ..
157
-    })
158
-    .then((res) => {
159
-      // the path should be dirs.DocumentDir + 'path-to-file.anything'
160
-      console.log('The file saved to ', res.path())
161
-    })
149
+let dirs = RNFetchBlob.fs.dirs
150
+RNFetchBlob
151
+.config({
152
+  // response data will be saved to this path if it has access right.
153
+  path : dirs.DocumentDir + '/path-to-file.anything'
154
+})
155
+.fetch('GET', 'http://www.example.com/file/example.zip', {
156
+  //some headers ..
157
+})
158
+.then((res) => {
159
+  // the path should be dirs.DocumentDir + 'path-to-file.anything'
160
+  console.log('The file saved to ', res.path())
162
 })
161
 })
163
 ```
162
 ```
164
 
163
 
537
 
536
 
538
 `0.5.0`
537
 `0.5.0`
539
 
538
 
540
-#### getSystemDirs():Promise
539
+#### getSystemDirs():Map<String, String>
541
 
540
 
542
 This method returns common used folders:
541
 This method returns common used folders:
543
 - DocumentDir
542
 - DocumentDir
544
 - CacheDir
543
 - CacheDir
545
 - DCIMDir (Android Only)
544
 - DCIMDir (Android Only)
546
 - DownloadDir (Android Only)
545
 - DownloadDir (Android Only)
547
-- MisucDir (Android Only)
546
+- MusicDir (Android Only)
548
 - PictureDir (Android Only)
547
 - PictureDir (Android Only)
549
 - MovieDir (Android Only)
548
 - MovieDir (Android Only)
549
+- RingtoneDir (Android Only)
550
 
550
 
551
 ```js
551
 ```js
552
-RNFetchBlob.getSystemDirs().then((dirs) => {
553
-    console.log(dirs.DocumentDir)
554
-    console.log(dirs.CacheDir)
555
-    console.log(dirs.DCIMDir)
556
-    console.log(dirs.DownloadDir)
557
-})
552
+const dirs = RNFetchBlob.fs.dirs
553
+console.log(dirs.DocumentDir)
554
+console.log(dirs.CacheDir)
555
+console.log(dirs.DCIMDir)
556
+console.log(dirs.DownloadDir)
558
 ```
557
 ```
559
 > If you're going to make downloaded file visible in Android `Downloads` app, please see [Show Downloaded File and Notification in Android Downloads App](#user-content-show-downloaded-file-and-notifiction-in-android-downloads-app).
558
 > If you're going to make downloaded file visible in Android `Downloads` app, please see [Show Downloaded File and Notification in Android Downloads App](#user-content-show-downloaded-file-and-notifiction-in-android-downloads-app).
560
 
559