Skip to content
Browse files

Get the full document rather than just the first chunk

  • Loading branch information...
1 parent bd9a85e commit f90a79a8119b6a02c5ceb6713390cb2441743855 Michael Hughes committed
Showing with 5 additions and 1 deletion.
  1. +5 −1 src/server/collector/bulkcollector.coffee
View
6 src/server/collector/bulkcollector.coffee
@@ -9,14 +9,18 @@ exports.url = (setNumber)-> "http://www.brickset.com/webservices/brickset.asmx/s
exports.createBulkCollector = (connectionString, urlGenerator)->
setInformation:(setNumber,fun)->
+ console.log "Retrieving:#{setNumber}"
@requestSetXml setNumber,(data)=>
@parseXml data,fun
requestSetXml:(setNumber,fun)->
+ data=""
http.get urlGenerator(setNumber), (res) ->
res.setEncoding('utf8')
res.on 'data', (chunk)->
- fun(chunk)
+ data=data+chunk
+ res.on 'end', ()->
+ fun(data)
.on 'error', (e)->
console.log("Got error: " + e.message)

0 comments on commit f90a79a

Please sign in to comment.
Something went wrong with that request. Please try again.