Browse Source

Update README.md

Ben Hsieh 8 years ago
parent
commit
734ee88dd5
1 changed files with 23 additions and 7 deletions
  1. 23
    7
      README.md

+ 23
- 7
README.md View File

69
 
69
 
70
 #### Download to storage directly
70
 #### Download to storage directly
71
 
71
 
72
-If you want to save the response data directly into file storage rather than convert response data into base64 for some reason.
73
-
74
-Put a `config` before calling `fetch`. There're three options which are `path`, `fileCache`, and `appendExt` that let you decide how and where to save the file.
75
-
76
 The simplest way is give a `fileCach` option to config, and set it to `true`. This will let the incoming response data stored in a temporary path **wihout** any file extension.
72
 The simplest way is give a `fileCach` option to config, and set it to `true`. This will let the incoming response data stored in a temporary path **wihout** any file extension.
77
 
73
 
78
 ```js
74
 ```js
91
   })
87
   })
92
 ```
88
 ```
93
 
89
 
90
+**Set Temp File Extension**
91
+
94
 But in some cases, you might need a file extension even the file is temporary cached. For instance, when use the file path as source of `Image` element the path should end with something like .png or .jpg, you can do this by put one more option in to `config`.
92
 But in some cases, you might need a file extension even the file is temporary cached. For instance, when use the file path as source of `Image` element the path should end with something like .png or .jpg, you can do this by put one more option in to `config`.
95
 
93
 
96
 ```js
94
 ```js
111
     imageView = <Image source={{ uri : Platform.OS === 'android' ? 'file://' : '' + res.path() }}/>
109
     imageView = <Image source={{ uri : Platform.OS === 'android' ? 'file://' : '' + res.path() }}/>
112
   })
110
   })
113
 ```
111
 ```
112
+**Use Specific File Path**
114
 
113
 
115
 What's more, if you prefer a specific path, rather a random generated path, you can use `path` option. We've added a [getSystemDirs](#user-content-getsysdirs) API in v0.5.0 that lists several common used directories.
114
 What's more, if you prefer a specific path, rather a random generated path, you can use `path` option. We've added a [getSystemDirs](#user-content-getsysdirs) API in v0.5.0 that lists several common used directories.
116
 
115
 
266
     'base64',
265
     'base64',
267
     // file path
266
     // file path
268
     PATH_TO_THE_FILE,
267
     PATH_TO_THE_FILE,
269
-    // (optional) buffer size, default to 1024 (1026 for BASE64 encoded data)
268
+    // (optional) buffer size, default to 4096 (4098 for BASE64 encoded data)
270
     // when reading file in BASE64 encoding, buffer size must be multiples of 3.
269
     // when reading file in BASE64 encoding, buffer size must be multiples of 3.
271
-    1026)
270
+    4098)
272
 stream.onData((chunk) => {
271
 stream.onData((chunk) => {
273
   data += chunk
272
   data += chunk
274
 })
273
 })
282
 
281
 
283
 #### Release cache files
282
 #### Release cache files
284
 
283
 
284
+TODO
285
 
285
 
286
 ## API
286
 ## API
287
 
287
 
288
+#### `getSystemDirs`
289
+
290
+TODO
291
+
292
+#### `config`
293
+
294
+TODO
295
+
288
 #### `fetch(method, url, headers, body):Promise<FetchBlobResponse>`
296
 #### `fetch(method, url, headers, body):Promise<FetchBlobResponse>`
289
 
297
 
290
 Send a HTTP request uses given headers and body, and return a Promise.
298
 Send a HTTP request uses given headers and body, and return a Promise.
316
 RNFetchBlob.base64.decode(data)
324
 RNFetchBlob.base64.decode(data)
317
 ```
325
 ```
318
 
326
 
319
-### FetchBlobResponse
327
+#### `unlink`
328
+
329
+TODO
330
+
331
+#### `readStream`
332
+
333
+TODO
334
+
335
+#### FetchBlobResponse
320
 
336
 
321
 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)
337
 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)
322
 
338