Skip to content

Commit ed97445

Browse files
author
Aries Yuwono
committed
updated with stream chunked
1 parent bc25f61 commit ed97445

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

test-complete/nodejs-documents-write-large.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ describe('Large document write test', function(){
6161
}, done);
6262
});
6363

64-
it('should read the large document with Readable stream', function(done){
64+
/*it('should read the large document with Readable stream', function(done){
6565
this.timeout(30000);
6666
var uri = '/test/write/shaks200all.xml';
6767
dbReader.documents.read(uri).
@@ -72,6 +72,25 @@ describe('Large document write test', function(){
7272
//console.log(JSON.stringify(documents, null, 2));
7373
done();
7474
}, done);
75+
});*/
76+
77+
it('should read the large document with Readable stream', function(done){
78+
this.timeout(30000);
79+
var uri = '/test/write/shaks200all.xml';
80+
var chunks = 0;
81+
var length = 0;
82+
dbReader.documents.read(uri).stream('chunked').
83+
on('data', function(chunk){
84+
//console.log(chunk);
85+
//console.log(chunk.length);
86+
chunks++;
87+
length += chunk.length;
88+
}).
89+
on('end', function(){
90+
//console.log('read '+ chunks + ' chunks of ' + length + ' length');
91+
length.should.equal(7648280);
92+
done();
93+
}, done);
7594
});
7695

7796
it('should read the large document metadata', function(done) {

0 commit comments

Comments
 (0)