mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
refactor(main) sendFile
This commit is contained in:
parent
a47cb5d0a9
commit
9ecf001945
1 changed files with 10 additions and 9 deletions
|
|
@ -260,27 +260,28 @@
|
|||
* @param pName - имя файла
|
||||
* @param pGzip - данные сжаты gzip'ом
|
||||
*/
|
||||
function sendFile(pParams) {
|
||||
var header, lRet = checkParams(pParams);
|
||||
function sendFile(params) {
|
||||
var isGzip, header,
|
||||
p = params,
|
||||
ret = checkParams(params);
|
||||
|
||||
if (lRet) {
|
||||
var p = pParams,
|
||||
lGzip = isGZIP(p.request) && p.gzip;
|
||||
if (ret) {
|
||||
isGzip = isGZIP(p.request) && p.gzip;
|
||||
|
||||
mainSetHeader(pParams);
|
||||
mainSetHeader(params);
|
||||
|
||||
pipe.create({
|
||||
from : p.name,
|
||||
write : p.response,
|
||||
gzip : lGzip,
|
||||
gzip : isGzip,
|
||||
callback: function(error) {
|
||||
if (error)
|
||||
sendError(pParams, error);
|
||||
sendError(params, error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return lRet;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue