You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 16, 2019. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+67-8Lines changed: 67 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -340,19 +340,21 @@ See [fs](#user-content-fs) chapter for more information
340
340
341
341
In `v0.5.0` we've added `writeStream` and `readStream`, which allows your app read/write data from file path. This API creates a file stream, rather than convert whole data into BASE64 encoded string, it's handy when processing **large files**.
342
342
343
-
But there're some differences between `readStream` and `writeStream` API. When calling `readStream` method, the file stream is opened immediately, and start to read data.
343
+
When calling `readStream` method, you have to `open` the stream, and start to read data.
344
344
345
345
```js
346
346
let data =''
347
347
let ifstream =RNFetchBlob.readStream(
348
-
// encoding, should be one of `base64`, `utf8`
348
+
// encoding, should be one of `base64`, `utf8`, `ascii`
349
349
'base64',
350
350
// file path
351
351
PATH_TO_THE_FILE,
352
352
// (optional) buffer size, default to 4096 (4095 for BASE64 encoded data)
353
353
// when reading file in BASE64 encoding, buffer size must be multiples of 3.
354
354
4095)
355
355
ifstream.onData((chunk) => {
356
+
// when encoding is `ascii`, chunk will be an array contains numbers
357
+
// otherwise it will be a string
356
358
data += chunk
357
359
})
358
360
ifstream.onError((err) => {
@@ -443,6 +445,8 @@ You can also group the requests by using `session` API, and use `dispose` to rem
443
445
444
446
Config API was introduced in `v0.5.0` which provides some options for the `fetch` task.
445
447
448
+
see [RNFetchBlobConfig](#user-content-rnfetchblobconfig)
If you're going to make downloaded file visible in Android `Downloads` app, please see [Show Downloaded File and Notification in Android Downloads App](#user-content-show-downloaded-file-in-android-downloads-app).
0 commit comments