Friday 27 October 2017

[Advice]How to give a file that's not text?

I've been doing: fs.readFile(filename, function(err, data){ if (err) throw err; response.writeHead(200, {'Content-Type': 'image/jpg'}); //response.write('

'+ data +'

'); PRODUCES WRITE AFTER END ERROR response.end(data); }); console.log('looks like it went through this code and did absolutely nothing!!!!\n'); Like the log says it doesn't seem to do anything and throws no errors. What gives?

Submitted October 27, 2017 at 08:31PM by ImpatientTomato

No comments:

Post a Comment