node.js - How to read binary files in node js -


i trying fetch content of binary file in binary format. think doing wrong. can help?

code sample

var fs = require('fs');  fs.open('public/abc.bin', '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) {         response['msg'] = buffer.tostring('utf-8', 0, num);         res.json(response);     }); }); 


Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -