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 -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -