How to read binary file byte by byte using javascript?
<p>I need to read the binary file byte by byte using javascript.I had got below code in this site,but its not working.I think i have to add some extra src file as a reference to it.Please help me to do it.here the code...</p>

<pre><code>var fs = require('fs');
var Buffer = require('buffer').Buffer;
var constants = require('constants');

fs.open("file.txt", 'r', function(status, fd) {
    if (status) {
        console.log(status.message);
        return;
    }
    var buffer = new Buffer(100);
    fs.read(fd, buffer, 0, 100, 0, function(err, num) {
        console.log(buffer.toString('utf-8', 0, num));
    });
}); 
</code></pre>
