@ossiana/node-libcurl 1.3.0 → 1.3.5
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 +5 -5
- package/readme.md +8 -22
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ossiana/node-libcurl",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.5",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "Ossian"
|
|
6
6
|
},
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
"typescript": "^4.9.4"
|
|
29
29
|
},
|
|
30
30
|
"optionalDependencies": {
|
|
31
|
-
"@ossiana/node-libcurl-darwin-x64": "1.3.
|
|
32
|
-
"@ossiana/node-libcurl-darwin-arm64": "1.3.
|
|
33
|
-
"@ossiana/node-libcurl-linux-x64-gnu": "1.3.
|
|
34
|
-
"@ossiana/node-libcurl-win32-x64-msvc": "1.3.
|
|
31
|
+
"@ossiana/node-libcurl-darwin-x64": "1.3.5",
|
|
32
|
+
"@ossiana/node-libcurl-darwin-arm64": "1.3.5",
|
|
33
|
+
"@ossiana/node-libcurl-linux-x64-gnu": "1.3.5",
|
|
34
|
+
"@ossiana/node-libcurl-win32-x64-msvc": "1.3.5"
|
|
35
35
|
},
|
|
36
36
|
"main": "./dist/index.js",
|
|
37
37
|
"files": [
|
package/readme.md
CHANGED
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
| __Windows (arm)__ | __No__ |
|
|
25
25
|
| __Ubuntu (x86_64)__ | __Yes__ |
|
|
26
26
|
| __MacOS (x86_64)__ | __Yes__ |
|
|
27
|
-
| __MacOS (arm64)__ |
|
|
27
|
+
| __MacOS (arm64)__ | __Yes__ |
|
|
28
28
|
------------
|
|
29
29
|
|
|
30
|
-
## How to
|
|
30
|
+
## How to Install
|
|
31
31
|
> npm i -g @ossiana/node-libcurl
|
|
32
32
|
------------
|
|
33
33
|
|
|
@@ -35,11 +35,16 @@
|
|
|
35
35
|
|
|
36
36
|
## Use Sample
|
|
37
37
|
|
|
38
|
-
### import
|
|
38
|
+
### import as ES Module
|
|
39
39
|
```javascript
|
|
40
40
|
import { LibCurl, fetch, requests } from '@ossiana/node-libcurl'
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
+
### import as CommonJS Module
|
|
44
|
+
```javascript
|
|
45
|
+
const { LibCurl, fetch, requests } = require('@ossiana/node-libcurl')
|
|
46
|
+
```
|
|
47
|
+
|
|
43
48
|
### browser fetch style
|
|
44
49
|
```javascript
|
|
45
50
|
fetch("https://xxx.io/api/graphql/").then(e => e.json())
|
|
@@ -58,23 +63,4 @@ const res = await session.get('https://www.baidu.com', {
|
|
|
58
63
|
console.log(res.headersMap);
|
|
59
64
|
console.log(session.getCookiesMap().get('ua'));
|
|
60
65
|
console.log(res.text);
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
### winhttp style
|
|
66
|
-
```javascript
|
|
67
|
-
const curl = new LibCurl();
|
|
68
|
-
curl.open('POST', 'https://xxx.io/api/graphql/');
|
|
69
|
-
curl.setRequestHeaders(`Host: xxx.io
|
|
70
|
-
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36
|
|
71
|
-
Content-Type: application/octet-stream
|
|
72
|
-
Referer: https://xxx.io/
|
|
73
|
-
Accept-Encoding: gzip, deflate, br
|
|
74
|
-
Accept-Language: zh-CN,zh;q=0.9
|
|
75
|
-
`);
|
|
76
|
-
curl.send(new Uint8Array([1, 255, 188]))
|
|
77
|
-
.then(e => {
|
|
78
|
-
console.log(curl.getResponseString());
|
|
79
|
-
});
|
|
80
66
|
```
|