minor changes

This commit is contained in:
coderaiser 2012-11-22 08:45:20 -05:00
parent b1c6c5e3ed
commit 2ed4a37f70

View file

@ -44,7 +44,10 @@
exports.https = require('https'),
exports.path = require('path'),
exports.url = require('url'),
exports.querystring = require('querystring'),
exports.querystring = require('querystring'),
/* compitability with old versions of node */
exports.fs.exists = exports.fs.exists || exports.path.exists;
/* Needed Modules */
exports.util = Util = require(LIBDIR + 'util'),
@ -171,11 +174,9 @@
lEnc = lReq.headers['accept-encoding'] || '',
lGzip = lEnc.match(/\bgzip\b/),
lReadStream,
/* compitability with old versions of node */
lExists = main.fs.exists || main.path.exists;
lReadStream;
lExists(lName, function(pExist){
main.fs.exists(lName, function(pExist){
lRet = pExist;
if(pExist){
lReadStream = main.fs.createReadStream(lName, {
@ -189,8 +190,11 @@
lReadStream.pipe(lRes);
}
else{
var lJson = JSON.stringify({
error: 'File not Found'
});
lRes.writeHead(ERROR, 'OK');
var lJson = JSON.stringify({error: 'File not Found'});
lRes.end(lJson);
}
});