[Ndn-interest] data_object_issue

Giuseppe Carella gcarella228 at gmail.com
Wed Oct 25 08:11:14 PDT 2017


Good morning community,

This is the topology I have (I am using ndn-js on both consumer and
producer side):

    PRODUCER------NFD-----CONSUMER

I am trying to create a data packet on the producer side every time it
receives an interest packet from the consumer.
The producer is sending an image; therefore it means that I have to split
the contents into chunks of fixed dimension.
This is what I do:
1) var files = document.getElementById('files').files;
    var file = files[0];
2) I get the blob object from the file
    var blob = file.slice(start,end);
    printLine("The dimension is "+blob.size);--> the dimension is the right
one
3) I store the blob object into the data object using the method
data.setContent(blob)
4) When I want to get the dimension from the data content the result of the
print is 0.

var dim = data.getContent().size(
   function() {

     if (this.buffer != null)
        return this.buffer.length;
        else return 0;

   });

  printLine("The dimension is " +dim);---->0

What's wrong in what I have done?

Thank you.
Giuseppe.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndn-interest/attachments/20171025/8516e18e/attachment.html>


More information about the Ndn-interest mailing list