mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 18:55:26 +00:00
minor changes
This commit is contained in:
parent
b1c6c5e3ed
commit
2ed4a37f70
1 changed files with 10 additions and 6 deletions
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue