wkh237 před 8 roky
rodič
revize
e4268ece8c
1 změnil soubory, kde provedl 46 přidání a 8 odebrání
  1. 46
    8
      README.md

+ 46
- 8
README.md Zobrazit soubor

@@ -627,8 +627,8 @@ Create a directory named `path`
627 627
 
628 628
 ```js
629 629
 RNFetchBlob.fs.mkdir(PATH_TO_CREATE)
630
-.then(() => { ...})
631
-.catch((err) => { ...})
630
+.then(() => { ... })
631
+.catch((err) => { ... })
632 632
 ```
633 633
 
634 634
 #### ls(path:string):Promise<Array<String>>
@@ -636,27 +636,65 @@ RNFetchBlob.fs.mkdir(PATH_TO_CREATE)
636 636
 List files and directories in a `path`
637 637
 
638 638
 ```js
639
+RNFetchBlob.fs.ls(PATH_TO_LIST)
640
+    // files will an array contains filenames
641
+    .then((files) => {
642
+        console.log(files)
643
+    })
639 644
 ```
640 645
 
641 646
 #### mv(from:string, to:string):Promise
642 647
 
643
-TODO
648
+Move a file's location
649
+
650
+```js
651
+RNFetchBlob.fs.mv(FROM_PATH, TO_PATH)
652
+.then(() => { ... })
653
+.catch(() => { ... })
654
+```
644 655
 
645
-#### cp(path:string):Promise
656
+#### cp(src:string, dest:string):Promise
646 657
 
647
-TODO
658
+Copy a file.
659
+
660
+```js
661
+RNFetchBlob.fs.mv(SRC_PATH, DEST_PATH)
662
+.then(() => { ... })
663
+.catch(() => { ... })
664
+```
648 665
 
649 666
 #### exists(path:string):Promise<boolean>
650 667
 
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
+```
652 677
 
653 678
 #### isDir(path:string):Promise<boolean>
654 679
 
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
+```
656 688
 
657 689
 #### unlink(path:string):Promise<boolean>
658 690
 
659
-TODO
691
+Delete a file at `path`
692
+
693
+```js
694
+RNFetchBlob.fs.unlink(path)
695
+.then(() => { ... })
696
+.catch((err) => { ... })
697
+```
660 698
 
661 699
 ### Types
662 700