I'm reading a text file in node.js, like so:
var configfile = path.resolve(__diame, file);
fs.readFile(configfile, function (err, data) {
if(err) {
console.log(err);
}
var post_options = {
'host': 'localhost',
'port':'3001',
'path': '/thefile',
'method': 'POST',
'headers': {
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': Buffer.byteLength(data)
}
};
// Set up the request
var post_req = http.request(post_options, function(post_res) {
post_res.on('data', function (chunk) {
res.status(200);
res.send(chunk);
});
post_res.on('end', function(){
next();
retu;
})
});
post_req.write(data.toString("utf8", 0, data.length));
What I want is to deliver a text file that looks like the original. but I see that the line endings get tued into actual text like /n instead of just being read as line endings. I'm not sure how to fix this.
