|
@@ -6,6 +6,7 @@ import {
|
6
|
6
|
Text,
|
7
|
7
|
View,
|
8
|
8
|
ScrollView,
|
|
9
|
+ Linking,
|
9
|
10
|
Platform,
|
10
|
11
|
Dimensions,
|
11
|
12
|
Image,
|
|
@@ -24,7 +25,7 @@ const dirs = RNFetchBlob.fs.dirs
|
24
|
25
|
let prefix = ((Platform.OS === 'android') ? 'file://' : '')
|
25
|
26
|
let begin = Date.now()
|
26
|
27
|
|
27
|
|
-describe('oboe test', (report, done) => {
|
|
28
|
+describe('json stream via HTTP', (report, done) => {
|
28
|
29
|
|
29
|
30
|
let count = 0
|
30
|
31
|
JSONStream(`${TEST_SERVER_URL}/public/json-dummy.json`).node('name', (name) => {
|
|
@@ -39,3 +40,34 @@ describe('oboe test', (report, done) => {
|
39
|
40
|
})
|
40
|
41
|
|
41
|
42
|
})
|
|
43
|
+
|
|
44
|
+describe('json stream via fs', (report, done) => {
|
|
45
|
+
|
|
46
|
+ let fetch2 = new RNFetchBlob.polyfill.Fetch({
|
|
47
|
+ auto : true
|
|
48
|
+ })
|
|
49
|
+ let res = null
|
|
50
|
+ let count = 0
|
|
51
|
+
|
|
52
|
+ RNFetchBlob.config({
|
|
53
|
+ fileCache : true
|
|
54
|
+ })
|
|
55
|
+ .fetch('GET',`${TEST_SERVER_URL}/public/json-dummy.json`)
|
|
56
|
+ .then((resp) => {
|
|
57
|
+ res = resp
|
|
58
|
+ JSONStream({
|
|
59
|
+ url : RNFetchBlob.wrap(res.path()),
|
|
60
|
+ headers : { bufferSize : 10240 }
|
|
61
|
+ }).node('name', (name) => {
|
|
62
|
+ count++
|
|
63
|
+ if(Date.now() - begin < 100)
|
|
64
|
+ return
|
|
65
|
+ begin = Date.now()
|
|
66
|
+ report(<Info key="report" uid="100">
|
|
67
|
+ <Text>{count} records</Text>
|
|
68
|
+ </Info>)
|
|
69
|
+ done()
|
|
70
|
+ })
|
|
71
|
+ })
|
|
72
|
+
|
|
73
|
+})
|