I've been trying to find an example of how to read a jpeg image and then show the image.
var http = require('http'), fs = require('fs');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/html'});
fs.readFile('image.jpg', function (err, data) {
if (err) throw err;
res.write(data);
});
res.end();
}).listen(8124, "127.0.0.1");
console.log('Server running at http://127.0.0.1:8124/');
Tried the following code but I think the encoding needs to be set as buffer. Using console.log it outputs 'Object' for the data.