sintaxi / dbox

NodeJS SDK for Dropbox API (THIS LIBRARY IS OBSOLETE!!)
513 stars 91 forks source link

Return the readable stream object from request #25

Closed dtjm closed 12 years ago

dtjm commented 12 years ago

I am using this in my project to allow streaming of the Dropbox API response to the client. This is especially useful for streaming responses from GET /files. For example (with the 0.3.x API):

var stream = dbox.get("/dropbox/file.ext", opts, function(status, fileBuffer){
    // Handle error here
});

// Write each chunk of the Dropbox API to the client connection as it comes in
stream.on("data", function(chunk){
    res.write(chunk);
});

stream.on("end", function(){
    res.end();
});
sintaxi commented 12 years ago

This makes a lot of sense. I'm going to test out some edge cases and see how it goes.

dtjm commented 12 years ago

Cool! let me know how I can help.