@less-is-more/less-js 1.5.0-11 → 1.5.0-12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/cache.js +11 -8
package/package.json
CHANGED
package/src/cache.js
CHANGED
|
@@ -118,16 +118,19 @@ module.exports = class Cache {
|
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
static _unzip(content) {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
121
|
+
if (typeof content === "string") {
|
|
122
|
+
let text = "";
|
|
123
|
+
const buffer = Buffer.from(content, "base64");
|
|
124
|
+
// 判断是否gzip
|
|
125
|
+
if (buffer.length > 2 && buffer[0] === 0x1f && buffer[1] === 0x8b) {
|
|
126
|
+
text = zlib.gunzipSync(buffer).toString();
|
|
127
|
+
} else {
|
|
128
|
+
text = content;
|
|
129
|
+
}
|
|
130
|
+
return text;
|
|
127
131
|
} else {
|
|
128
|
-
|
|
132
|
+
return content;
|
|
129
133
|
}
|
|
130
|
-
return text;
|
|
131
134
|
}
|
|
132
135
|
|
|
133
136
|
static _needZip(text, zip) {
|