mm_https 1.5.5 → 1.5.6
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/index.js +3 -2
- package/package.json +1 -1
- package/test.js +15 -16
- package//344/272/214/347/273/264/347/240/201/qrcode.jpg +0 -0
package/index.js
CHANGED
|
@@ -30,7 +30,7 @@ class Http {
|
|
|
30
30
|
'Accept-Language': 'zh-CN,zh;q=0.9',
|
|
31
31
|
'Cache-Control': 'no-cache',
|
|
32
32
|
'Connection': 'keep-alive',
|
|
33
|
-
'Pragma': 'no-cache',
|
|
33
|
+
// 'Pragma': 'no-cache',
|
|
34
34
|
// 'sec-ch-ua': '" Not A;Brand";v="99", "Chromium";v="98", "Google Chrome";v="98"',
|
|
35
35
|
// 'sec-ch-ua-mobile': '?0',
|
|
36
36
|
// 'sec-ch-ua-platform': '"Windows"',
|
|
@@ -283,7 +283,8 @@ Http.prototype.request = function(options) {
|
|
|
283
283
|
case 'br':
|
|
284
284
|
case 'gzip':
|
|
285
285
|
case 'deflate':
|
|
286
|
-
|
|
286
|
+
buffer = unzipSync(buffer);
|
|
287
|
+
body = buffer.toString();
|
|
287
288
|
break;
|
|
288
289
|
default:
|
|
289
290
|
body = buffer.toString();
|
package/package.json
CHANGED
package/test.js
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
var Http = require('./index.js');
|
|
3
3
|
var fs = require("fs");
|
|
4
4
|
|
|
5
|
-
async function test(){
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
5
|
+
// async function test(){
|
|
6
|
+
// var http = new Http();
|
|
7
|
+
// var res = await http.get("https://www.baidu.com/");
|
|
8
|
+
// console.log("html", res);
|
|
9
|
+
// }
|
|
10
10
|
|
|
11
11
|
// async function test3() {
|
|
12
12
|
// // 将「微信对话开放平台」得到的信息填入
|
|
@@ -140,16 +140,15 @@ async function test(){
|
|
|
140
140
|
// test();
|
|
141
141
|
|
|
142
142
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
// download();
|
|
143
|
+
async function download(){
|
|
144
|
+
var hp = new Http();
|
|
145
|
+
var url = "https://www.copipi.com/p/224/224/becce1fc21d723614b598f5377d5d676.jpg";
|
|
146
|
+
"./二维码/中文".addDir();
|
|
147
|
+
var filename = "./二维码/qrcode.jpg".fullname();
|
|
148
|
+
var file = await hp.download(url, filename);
|
|
149
|
+
console.log(file);
|
|
150
|
+
}
|
|
151
|
+
download();
|
|
153
152
|
|
|
154
153
|
// async function test() {
|
|
155
154
|
// var http = new Http();
|
|
@@ -205,4 +204,4 @@ async function test(){
|
|
|
205
204
|
// // console.log("结果", res.body);
|
|
206
205
|
// }
|
|
207
206
|
|
|
208
|
-
test();
|
|
207
|
+
// test();
|
|
Binary file
|