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

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -