Streaming a binary file from riak via node.js to client

francisco treacy francisco.treacy at
Sat May 21 07:01:11 EDT 2011

and which node.js version?

2011/5/21 francisco treacy <francisco.treacy at>:
> That should work, but i'll take a look at it. Which versions of
> riak-js and Riak are you using?
> 2011/5/21 Max <nash12 at>:
>> After watching the presentation about how to use node.js with riak, I
>> built some small application on node.js using the express framework.
>> In riak files are stored via a PHP frontend but they should be served
>> via a node.js backend. Anyway, connecting to riak via node.js is not
>> that hard and sending the response is also rather easy. But it seems,
>> somewhere the buffer I get via the client.get operation is truncated.
>> I am using this code:
>> app.get('/images/', function(req, res){
>>    riakClient.get('images', 'some.jpg', function(err, image, meta) {
>>        if (err) {
>>            throw err;
>>        }
>>        res.send(image, {
>>            'Content-Type': meta.contentType
>>        });
>>    });
>> });
>> To test if the image is served, but whenn I access the node.js url,
>> the browser tells me that the image cannot be displayed as it contains
>> errors. The filesize of the served image is too small compared to the
>> original. If I access the url /images/some.jpg directly via rest
>> interface on the command line, the correct image is returned.
>> Has anyone experience in how to stream binary data from riak?
>> Thanks in advance!
>> _______________________________________________
>> riak-users mailing list
>> riak-users at

More information about the riak-users mailing list