There is a following code:
var res = []; function response(data) { var chunk = data.splice( 0, 1000 ); res = res.concat( chunk.map( function