Hello all,
I have been working on this code and I cannot figure out what is going on. My code is as follows:
var http = require(‘http’);
var fs = require(‘fs’);
var map = require(‘through2-map’);
var port = process.argv[2];
var fileLocation = process.argv[3];
var srcStream = fs.createReadStream(fileLocation);
var server = http.createServer(function callback (req, res) {
srcStream.pipe(map(function(stream) {
return stream.toString().toUpperCase();
})).pipe(res);
});
server.listen(port);
when I run the program using node httpServer.js 8080 “./test/test.txt” my code is able to read the text file, upper-case the text and display it on the screen in all caps. when I run learnyounode verify httpServer.js I get this error:
fs.js:540
binding.open(pathModule._makeLong(path),
^
TypeError: path must be a string
at TypeError (native)
at Object.fs.open (fs.js:540:11)
at ReadStream.open (fs.js:1673:6)
at new ReadStream (fs.js:1660:10)
at Object.fs.createReadStream (fs.js:1608:10)
at Object. (/home/ubuntu/workspace/httpServer.js:7:20)
at Module._compile (module.js:409:26)
at Object.Module._extensions…js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
Your submission results compared to the expected:
✗ Error connecting to http://localhost:6753:
connect ECONNREFUSED 127.0.0.1:6753
✗ Submission results did not match expected!
Why am I not able to pass this challenge? Are the arguments being passed to my function the wrong type or is this a bug with the cloud9 service not being able to connect in the way learnyounode expects? thanks in advance!!