Skip to content
This repository was archived by the owner on Mar 16, 2019. It is now read-only.

Commit b9801ce

Browse files
committed
Update README.md
1 parent 4853273 commit b9801ce

File tree

1 file changed

+20
-21
lines changed

1 file changed

+20
-21
lines changed

README.md

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -146,19 +146,18 @@ RNFetchBlob
146146
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.
147147

148148
```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())
162161
})
163162
```
164163

@@ -537,24 +536,24 @@ RNFetchBlob.base64.decode(data)
537536

538537
`0.5.0`
539538

540-
#### getSystemDirs():Promise
539+
#### getSystemDirs():Map<String, String>
541540

542541
This method returns common used folders:
543542
- DocumentDir
544543
- CacheDir
545544
- DCIMDir (Android Only)
546545
- DownloadDir (Android Only)
547-
- MisucDir (Android Only)
546+
- MusicDir (Android Only)
548547
- PictureDir (Android Only)
549548
- MovieDir (Android Only)
549+
- RingtoneDir (Android Only)
550550

551551
```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)
558557
```
559558
> 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).
560559

0 commit comments

Comments
 (0)