Browse Source

Update README.md

wkh237 8 years ago
parent
commit
2cc625c3b1
1 changed files with 27 additions and 8 deletions
  1. 27
    8
      README.md

+ 27
- 8
README.md View File

361
 - cp
361
 - cp
362
 - exists
362
 - exists
363
 - isDir
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
 #### File Stream
370
 #### File Stream
368
 
371
 
399
 When use `writeStream`, the stream is also opened immediately, but you have to `write`, and `close` by yourself.
402
 When use `writeStream`, the stream is also opened immediately, but you have to `write`, and `close` by yourself.
400
 
403
 
401
 ```js
404
 ```js
402
-let ofstream = RNFetchBlob.writeStream(
405
+RNFetchBlob.writeStream(
403
     PATH_TO_FILE,
406
     PATH_TO_FILE,
404
     // encoding, should be one of `base64`, `utf8`, `ascii`
407
     // encoding, should be one of `base64`, `utf8`, `ascii`
405
     'utf8',
408
     'utf8',
406
     // should data append to existing content ?
409
     // should data append to existing content ?
407
     true)
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
     })
433
     })
429
 
434
 
430
   // remove file by specifying a path
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
 ```js
444
 ```js
440
 
445
 
541
 - CacheDir
546
 - CacheDir
542
 - DCIMDir (Android Only)
547
 - DCIMDir (Android Only)
543
 - DownloadDir (Android Only)
548
 - DownloadDir (Android Only)
549
+- MisucDir (Android Only)
550
+- PictureDir (Android Only)
551
+- MovieDir (Android Only)
544
 
552
 
545
 ```js
553
 ```js
546
 RNFetchBlob.getSystemDirs().then((dirs) => {
554
 RNFetchBlob.getSystemDirs().then((dirs) => {
707
 .catch((err) => { ... })
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
 ## Types
729
 ## Types
711
 
730
 
712
 ---
731
 ---
723
   When this property has value, `fetch` API will try to store response data in the path ignoring `fileCache` and `appendExt` property.
742
   When this property has value, `fetch` API will try to store response data in the path ignoring `fileCache` and `appendExt` property.
724
 #### addAndroidDownloads:object (Android only)
743
 #### addAndroidDownloads:object (Android only)
725
   This is an Android only property, it should be an object with the following properties :
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
   - description : File description of the file.
746
   - description : File description of the file.
728
   - mime : MIME type of the file. By default is `text/plain`
747
   - mime : MIME type of the file. By default is `text/plain`
729
   - 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))
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))