It works fine for me under three scenarios: (a) your example, with riak 0.14, riak-js 0.4 and node 0.4.7 (b) riak-js tests (fixture is an image) (c) my own app that does exactly that for certain images
The only thing that differs from your example is that i'm using the Luwak interface (getLarge instead of get). So last thing i can think of is that the image variable is not a Buffer. Could you check that? Francisco 2011/5/21 Max <nas...@gmail.com>: > Hi Francisco, > > thanks for your reply. The versions I use: > > riak: 0.14 > riak-js: 0.4 > node: 0.4.7 > > Thank you! > > On Sat, May 21, 2011 at 1:01 PM, francisco treacy > <francisco.tre...@gmail.com> wrote: >> and which node.js version? >> >> >> 2011/5/21 francisco treacy <francisco.tre...@gmail.com>: >>> 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 <nas...@gmail.com>: >>>> 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 >>>> >>> >> > _______________________________________________ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com