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

Commit e4268ec

Browse files
committed
Update README.md
1 parent f583f9e commit e4268ec

File tree

1 file changed

+46
-8
lines changed

1 file changed

+46
-8
lines changed

README.md

Lines changed: 46 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -627,36 +627,74 @@ Create a directory named `path`
627627

628628
```js
629629
RNFetchBlob.fs.mkdir(PATH_TO_CREATE)
630-
.then(() => { ...})
631-
.catch((err) => { ...})
630+
.then(() => { ... })
631+
.catch((err) => { ... })
632632
```
633633

634634
#### ls(path:string):Promise<Array<String>>
635635

636636
List files and directories in a `path`
637637

638638
```js
639+
RNFetchBlob.fs.ls(PATH_TO_LIST)
640+
// files will an array contains filenames
641+
.then((files) => {
642+
console.log(files)
643+
})
639644
```
640645

641646
#### mv(from:string, to:string):Promise
642647

643-
TODO
648+
Move a file's location
649+
650+
```js
651+
RNFetchBlob.fs.mv(FROM_PATH, TO_PATH)
652+
.then(() => { ... })
653+
.catch(() => { ... })
654+
```
644655

645-
#### cp(path:string):Promise
656+
#### cp(src:string, dest:string):Promise
646657

647-
TODO
658+
Copy a file.
659+
660+
```js
661+
RNFetchBlob.fs.mv(SRC_PATH, DEST_PATH)
662+
.then(() => { ... })
663+
.catch(() => { ... })
664+
```
648665

649666
#### exists(path:string):Promise<boolean>
650667

651-
TODO
668+
Check if a file exist at `path`
669+
670+
```js
671+
RNFetchBlob.fs.exists(PATH_OF_FILE)
672+
.then((exist) => {
673+
console.log(`file ${exist ? '' : 'not'} exists`)
674+
})
675+
.catch(() => { ... })
676+
```
652677

653678
#### isDir(path:string):Promise<boolean>
654679

655-
TODO
680+
Check the file at `path` is a directory or not. Resolves with `false` when the path is not a directory, or it does not exists.
681+
682+
```js
683+
RNFetchBlob.fs.exists(PATH_OF_FILE)
684+
.then((isDir) => {
685+
console.log(`file is ${isDir ? '' : 'not'} a directory`)
686+
})
687+
```
656688

657689
#### unlink(path:string):Promise<boolean>
658690

659-
TODO
691+
Delete a file at `path`
692+
693+
```js
694+
RNFetchBlob.fs.unlink(path)
695+
.then(() => { ... })
696+
.catch((err) => { ... })
697+
```
660698

661699
### Types
662700

0 commit comments

Comments
 (0)