Parse stream to object in Nodejs

I am trying Get an object from Amazon S3 storage in Node.Js.

And this perfectly works when I am saving it to a file.

amazon.getObject = function () {

    var options = {
        BucketName : 'mybucket',
        ObjectName : 'path/to/my.json',
        ResponseContentType : 'application/json'

    s3.GetObject(options, function(err, data) {
        var fs = require('fs');
        var fd = fs.openSync('helloaa.json', 'w+');
        fs.writeSync(fd, data.Body, 0, data.Body.length, 0);


In. helloaa.json is:

    "hello": 1,
    "world": 3

But. I don't want to write data to file on my disk.

I want parse this json to object with JSON.parse();

When I print object there with:

    s3.GetObject(options, function(err, data) {

In console is this:

:"Mon, 31 Dec 2012 00:11:48 GMT","last-modified":"Sun, 30 Dec 2012 23:22:57        "etag":"\"8677a54c9b693bb6fc040ede8cc6a\"","accept-ranges":"bytes","co

What is it?

How can I parse it?

Is it stream?

Can I save stream to object in NodeJs?


Have you tried data.Body.toString()?

I had to parse the JSON after converting to string:

    var fileContents = data.Body.toString();
    var json = JSON.parse(fileContents);

Need Your Help

Is there a jQuery plug-in that makes thumbnails of an image dynamically?

jquery jquery-plugins thumbnails image-gallery

Does anyone know of a jquery plugin that can make a thumbnail of an image hosted at another site (Flickr/Picasa/SmugMug/etc.)? I was trying to use Galleria, but didn't like it very much. It had the

using DTO with WCF

c# wcf entity-framework dto

I have a EFM which is mapped with a POCO Entity, and m using WCF for business logic