wkh237 преди 8 години
родител
ревизия
2cc625c3b1
променени са 1 файла, в които са добавени 27 реда и са изтрити 8 реда
  1. 27
    8
      README.md

+ 27
- 8
README.md Целия файл

@@ -361,8 +361,11 @@ Here's the list of `fs` APIs
361 361
 - cp
362 362
 - exists
363 363
 - isDir
364
+- lstat
365
+- stat
366
+- scanFile (Android Only)
364 367
 
365
-See [fs](#user-content-fs) chapter for more information
368
+See [fs chapter](#user-content-fs) for more information
366 369
 
367 370
 #### File Stream
368 371
 
@@ -399,15 +402,17 @@ RNFetchBlob.readStream(
399 402
 When use `writeStream`, the stream is also opened immediately, but you have to `write`, and `close` by yourself.
400 403
 
401 404
 ```js
402
-let ofstream = RNFetchBlob.writeStream(
405
+RNFetchBlob.writeStream(
403 406
     PATH_TO_FILE,
404 407
     // encoding, should be one of `base64`, `utf8`, `ascii`
405 408
     'utf8',
406 409
     // should data append to existing content ?
407 410
     true)
408
-ofstream.write('foo')
409
-ofstream.write('bar')
410
-ofstream.close()
411
+.then((ofstream) => {
412
+    ofstream.write('foo')
413
+    ofstream.write('bar')
414
+    ofstream.close()
415
+})
411 416
 
412 417
 ```
413 418
 
@@ -428,13 +433,13 @@ When using `fileCache` or `path` options along with `fetch` API, response data w
428 433
     })
429 434
 
430 435
   // remove file by specifying a path
431
-  RNFetchBlob.unlink('some-file-path').then(() => {
436
+  RNFetchBlob.fs.unlink('some-file-path').then(() => {
432 437
     // ...
433 438
   })
434 439
 
435 440
 ```
436 441
 
437
-You can also group the requests by using `session` API, and use `dispose` to remove them all when needed.
442
+You can also grouping requests by using `session` API, and use `dispose` to remove them all when needed.
438 443
 
439 444
 ```js
440 445
 
@@ -541,6 +546,9 @@ This method returns common used folders:
541 546
 - CacheDir
542 547
 - DCIMDir (Android Only)
543 548
 - DownloadDir (Android Only)
549
+- MisucDir (Android Only)
550
+- PictureDir (Android Only)
551
+- MovieDir (Android Only)
544 552
 
545 553
 ```js
546 554
 RNFetchBlob.getSystemDirs().then((dirs) => {
@@ -707,6 +715,17 @@ RNFetchBlob.fs.unlink(path)
707 715
 .catch((err) => { ... })
708 716
 ```
709 717
 
718
+#### lstat(path:string):Promise
719
+
720
+Get statistic data of a path, the result data will be an array contains objects like this :
721
+
722
+{
723
+    filename : 'foo.png',
724
+    path : '/path/to/the/file/wihout/file/name/',
725
+    size : 4901,
726
+    type : 'file'
727
+}
728
+
710 729
 ## Types
711 730
 
712 731
 ---
@@ -723,7 +742,7 @@ A set of configurations that will be injected into a `fetch` method, with the fo
723 742
   When this property has value, `fetch` API will try to store response data in the path ignoring `fileCache` and `appendExt` property.
724 743
 #### addAndroidDownloads:object (Android only)
725 744
   This is an Android only property, it should be an object with the following properties :
726
-  - title : title of the file download success notification
745
+  - title : title of the file
727 746
   - description : File description of the file.
728 747
   - mime : MIME type of the file. By default is `text/plain`
729 748
   - mediaScannable : A `boolean` value, see [Officail Document](https://developer.android.com/reference/android/app/DownloadManager.html#addCompletedDownload(java.lang.String, java.lang.String, boolean, java.lang.String, java.lang.String, long, boolean))