Browse Source

Update README.md

wkh237 8 years ago
parent
commit
096e8081f0
1 changed files with 28 additions and 13 deletions
  1. 28
    13
      README.md

+ 28
- 13
README.md View File

@@ -301,7 +301,7 @@ stream.onEnd(() => {
301 301
 
302 302
 #### Release cache files
303 303
 
304
-When using `fileCache` or `path` options along with `fetch` API, response data will automatically stored into file system. The files will **NOT** removed unless you `unlink` it. There're several way to remove the files
304
+When using `fileCache` or `path` options along with `fetch` API, response data will automatically stored into file system. The files will **NOT** removed unless you `unlink` it. There're several ways to remove the files
305 305
 
306 306
 ```js
307 307
 
@@ -336,7 +336,7 @@ You can also group the requests by using `session` API, and use `dispose` to rem
336 336
   })  
337 337
 
338 338
   RNFetchblob.config({
339
-    // you can also set session before hand
339
+    // you can also set session beforehand
340 340
     session : 'foo'
341 341
     fileCache : true
342 342
   })
@@ -358,11 +358,7 @@ You can also group the requests by using `session` API, and use `dispose` to rem
358 358
 
359 359
 ## API
360 360
 
361
-#### `getSystemDirs`
362
-
363
-TODO
364
-
365
-#### `config`
361
+#### `config(options:RNFetchBlobConfig):fetch`
366 362
 
367 363
 TODO
368 364
 
@@ -388,6 +384,10 @@ Register on progress event handler for a fetch request.
388 384
 
389 385
 A function that triggers when there's data received/sent, first argument is the number of sent/received bytes, and second argument is expected total bytes number.
390 386
 
387
+#### `session(name:string):RNFetchBlobSession`
388
+
389
+TODO
390
+
391 391
 #### `base64`
392 392
 
393 393
 A helper object simply uses [base-64](https://github.com/mathiasbynens/base64) for decode and encode BASE64 data.
@@ -397,15 +397,13 @@ RNFetchBlob.base64.encode(data)
397 397
 RNFetchBlob.base64.decode(data)
398 398
 ```
399 399
 
400
-#### `unlink`
400
+#### `fs`
401 401
 
402 402
 TODO
403 403
 
404
-#### `readStream`
405
-
406
-TODO
404
+### Types
407 405
 
408
-#### FetchBlobResponse
406
+#### RNFetchBlobResponse
409 407
 
410 408
 When `fetch` success, it resolve a `FetchBlobResponse` object as first argument. `FetchBlobResponse` object has the following methods (these method are synchronous, so you might take quite a performance impact if the file is big)
411 409
 
@@ -415,6 +413,23 @@ When `fetch` success, it resolve a `FetchBlobResponse` object as first argument.
415 413
   returns json parsed object (done in js context)
416 414
 #### text():string
417 415
   returns decoded base64 string (done in js context)
416
+#### path():string
417
+  returns file path if the response data is cached in file
418
+#### session(name:string):RNFetchBlobSession
419
+  when the response data is cached in a file, this method adds the file into the session. The following usages are equivalent.
420
+```js
421
+RNFetchBlob.session('session-name').add(resp.path())
422
+// or
423
+resp.session('session-name')
424
+```
425
+
426
+#### RNFetchBlobSession
427
+
428
+TODO
429
+
430
+#### RNFetchBlobStream
431
+
432
+TODO
418 433
 
419 434
 ## Major Changes
420 435
 
@@ -424,7 +439,7 @@ When `fetch` success, it resolve a `FetchBlobResponse` object as first argument.
424 439
 | 0.4.0 | Add base-64 encode/decode library and API |
425 440
 | 0.4.1 | Fixe upload form-data missing file extension problem on Android |
426 441
 | 0.4.2 | Supports upload/download progress |
427
-| 0.5.0 | Upload/download with direct access to file storage, and also supports read file with file stream |
442
+| 0.5.0 | Upload/download with direct access to file storage, and also added file access APIs |
428 443
 
429 444
 ### TODOs
430 445