flex-combo
Advanced tools
Comparing version 0.2.4 to 0.2.5
@@ -56,2 +56,5 @@ var http = require('http') | ||
function isBinFile(fileName){ | ||
return !/.js$|.css$|.less$/.test(fileName); | ||
} | ||
/* | ||
@@ -82,2 +85,5 @@ * 根据一个文件的全路径(如:/xxx/yyy/aa.js)从本地文件系统获取内容 | ||
var buff = fs.readFileSync(absPath); | ||
if(isBinFile(absPath)){ | ||
return buff; | ||
} | ||
var charset = isUtf8(buff) ? 'utf8' : 'gbk'; | ||
@@ -115,2 +121,5 @@ return adaptCharset(buff, param.charset, charset); | ||
var buff = fs.readFileSync(absPath); | ||
if(isBinFile(absPath)){ | ||
return buff; | ||
} | ||
var charset = isUtf8(buff) ? 'utf8' : 'gbk'; | ||
@@ -181,4 +190,13 @@ return adaptCharset(buff, param.charset, charset); | ||
var buff = joinbuffers(buffs); | ||
//fix 80% situation bom problem.quick and dirty | ||
if(buff[0] === 239 && buff[1] === 187 && buff[2] === 191) { | ||
buff = buff.slice(3, buff.length); | ||
} | ||
if(isBinFile(url)){ | ||
cacheFile(url, buff); | ||
res.end(buff); | ||
return; | ||
} | ||
var charset = isUtf8(buff) ? 'utf8' : 'gbk'; | ||
var singleFileContent = adaptCharset(buff, param.charset, charset); | ||
@@ -268,6 +286,10 @@ cacheFile(url, buff, charset); | ||
} | ||
var fileName = crypto.createHash('md5').update(reqArray[id].file).digest('hex'); | ||
if(isBinFile(reqArray[id].file)){ | ||
reqArray[id].content = buff; | ||
cacheFile('/'+fileName, buff); | ||
return; | ||
} | ||
var charset = isUtf8(buff) ? 'utf8' : 'gbk'; | ||
reqArray[id].content = adaptCharset(buff, param.charset, charset); | ||
var fileName = crypto.createHash('md5').update(reqArray[id].file).digest('hex'); | ||
cacheFile('/'+fileName, buff, charset); | ||
@@ -274,0 +296,0 @@ sendData(); |
{ | ||
"name": "flex-combo", | ||
"version": "0.2.4", | ||
"version": "0.2.5", | ||
"description": "The Flex-combo is combo tool designed for web front-end developer. It support various kinds of combo format by modify configuration(eg. yahoo combo).", | ||
@@ -5,0 +5,0 @@ "main": "flex-combo.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16692
305