Comparing version 0.1.0 to 1.0.0
1.0.0 / 2014-09-17 | ||
================== | ||
* add peek size, default is 512. fixed #4 | ||
0.1.0 / 2014-07-05 | ||
@@ -3,0 +8,0 @@ ================== |
@@ -20,2 +20,4 @@ /*! | ||
module.exports = charset; | ||
/** | ||
@@ -31,3 +33,4 @@ * guest data charset from req.headers, xml, html content-type meta tag | ||
* @param {Object} obj `Content-Type` String, or `res.headers`, or `res` Object | ||
* @param {Buffer} data | ||
* @param {Buffer} [data] content buffer | ||
* @param {Number} [peekSize] max content peek size, default is 512 | ||
* @return {String} charset, lower case, e.g.: utf8, gbk, gb2312, .... | ||
@@ -37,7 +40,9 @@ * If can\'t guest, return null | ||
*/ | ||
module.exports = function charset(obj, data) { | ||
function charset(obj, data, peekSize) { | ||
var matchs = null; | ||
var end = 0; | ||
if (data) { | ||
end = data.length > 512 ? 512 : data.length; | ||
peekSize = peekSize || 512; | ||
// https://github.com/node-modules/charset/issues/4 | ||
end = data.length > peekSize ? peekSize : data.length; | ||
} | ||
@@ -72,2 +77,2 @@ // charset('text/html;charset=gbk') | ||
return cs; | ||
}; | ||
} |
{ | ||
"name": "charset", | ||
"version": "0.1.0", | ||
"version": "1.0.0", | ||
"description": "Get the content charset from header and html content-type.", | ||
@@ -5,0 +5,0 @@ "main": "index.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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
13109
69
0