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@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to