@mherod/get-cookie 4.1.0 โ 4.2.2
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/.env.example +5 -0
- package/.husky/commit-msg +6 -2
- package/.husky/pre-commit +6 -4
- package/.husky/pre-push +6 -4
- package/README.md +76 -117
- package/dist/cli.cjs +1 -3
- package/dist/cli.cjs.map +1 -1
- package/dist/index.cjs +1 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +220 -41
- package/dist/index.d.ts +220 -41
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/eslint.config.js +8 -18
- package/examples/README.md +37 -0
- package/examples/advanced-usage.ts +56 -0
- package/examples/basic-usage.ts +43 -0
- package/examples/cli-examples.sh +51 -0
- package/package.json +13 -4
- package/tsconfig.build.json +2 -2
- package/tsconfig.cli.json +12 -0
- package/tsconfig.tsup.json +12 -0
- package/tsup.cli.ts +1 -0
- package/tsup.lib.ts +1 -0
- package/dist/chunk-3FVH4L25.js +0 -2
- package/dist/chunk-3FVH4L25.js.map +0 -1
- package/dist/chunk-56Z35D5R.js +0 -2
- package/dist/chunk-56Z35D5R.js.map +0 -1
- package/dist/chunk-7XZ7PCDJ.js +0 -2
- package/dist/chunk-7XZ7PCDJ.js.map +0 -1
- package/dist/chunk-DVWQBWUF.js +0 -4
- package/dist/chunk-DVWQBWUF.js.map +0 -1
- package/dist/chunk-I6AYGFSQ.js +0 -2
- package/dist/chunk-I6AYGFSQ.js.map +0 -1
- package/dist/chunk-U27I5BLR.js +0 -2
- package/dist/chunk-U27I5BLR.js.map +0 -1
- package/dist/chunk-YOZOS2YM.js +0 -2
- package/dist/chunk-YOZOS2YM.js.map +0 -1
- package/dist/getChromeCookie-2ROVM47V.js +0 -2
- package/dist/getChromeCookie-2ROVM47V.js.map +0 -1
- package/dist/getChromePassword-O452VQWI.js +0 -2
- package/dist/getChromePassword-O452VQWI.js.map +0 -1
- package/dist/getCookie-CRE6M3GI.js +0 -2
- package/dist/getCookie-CRE6M3GI.js.map +0 -1
- package/dist/getFirefoxCookie-5P74VDC7.js +0 -2
- package/dist/getFirefoxCookie-5P74VDC7.js.map +0 -1
- package/dist/getGroupedRenderedCookies-DFEJTTC6.js +0 -2
- package/dist/getGroupedRenderedCookies-DFEJTTC6.js.map +0 -1
- package/dist/getMergedRenderedCookies-W5GSSHQQ.js +0 -2
- package/dist/getMergedRenderedCookies-W5GSSHQQ.js.map +0 -1
package/.env.example
ADDED
package/.husky/commit-msg
CHANGED
package/.husky/pre-commit
CHANGED
package/.husky/pre-push
CHANGED
package/README.md
CHANGED
|
@@ -1,151 +1,101 @@
|
|
|
1
1
|
# get-cookie ๐ช
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Tired of manually copying cookies for API testing? `get-cookie` extracts authentication cookies directly from Chrome, Firefox, and Safari - perfect for testing, debugging, and automation.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Quick Start ๐
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
- ๐งช Integration testing with real browser cookies
|
|
11
|
-
|
|
12
|
-
## Documentation ๐
|
|
13
|
-
|
|
14
|
-
Visit our [comprehensive documentation](https://mherod.github.io/get-cookie/) for:
|
|
15
|
-
|
|
16
|
-
- Detailed API reference
|
|
17
|
-
- Getting started guides
|
|
18
|
-
- Advanced usage examples
|
|
19
|
-
- TypeScript type definitions
|
|
20
|
-
|
|
21
|
-
## Features โจ
|
|
22
|
-
|
|
23
|
-
- ๐ **Multi-Browser Support**: Works with Chrome, Firefox, and Safari
|
|
24
|
-
- ๐ **Secure**: Safe cookie extraction with proper encryption handling
|
|
25
|
-
- ๐ **TypeScript Ready**: Built with TypeScript for excellent type safety
|
|
26
|
-
- ๐ฏ **Flexible Querying**: Search by name, domain, or URL pattern
|
|
27
|
-
- ๐ **Multiple Output Formats**: JSON, rendered, or grouped results
|
|
28
|
-
- ๐ฅ **Profile Support**: Query cookies from different browser profiles
|
|
29
|
-
|
|
30
|
-
## Installation ๐ฆ
|
|
7
|
+
```bash
|
|
8
|
+
# Install globally
|
|
9
|
+
pnpm add -g @mherod/get-cookie
|
|
31
10
|
|
|
32
|
-
|
|
11
|
+
# Get a cookie
|
|
12
|
+
get-cookie auth example.com
|
|
33
13
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
14
|
+
# Get all cookies for a domain
|
|
15
|
+
get-cookie % example.com
|
|
16
|
+
```
|
|
37
17
|
|
|
38
|
-
|
|
39
|
-
|
|
18
|
+
```typescript
|
|
19
|
+
// Node.js usage
|
|
20
|
+
import { getCookie } from "@mherod/get-cookie";
|
|
40
21
|
|
|
41
|
-
|
|
42
|
-
|
|
22
|
+
const cookies = await getCookie({
|
|
23
|
+
name: "auth",
|
|
24
|
+
domain: "example.com",
|
|
25
|
+
});
|
|
43
26
|
```
|
|
44
27
|
|
|
45
|
-
|
|
28
|
+
โ ๏ธ **Platform Support**:
|
|
46
29
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
30
|
+
- Chrome: macOS only
|
|
31
|
+
- Firefox: macOS and Linux
|
|
32
|
+
- Safari: macOS only
|
|
50
33
|
|
|
51
|
-
|
|
52
|
-
npm install -g @mherod/get-cookie
|
|
34
|
+
## Installation ๐ฆ
|
|
53
35
|
|
|
54
|
-
|
|
55
|
-
|
|
36
|
+
```bash
|
|
37
|
+
pnpm add @mherod/get-cookie # recommended
|
|
38
|
+
npm install @mherod/get-cookie # or npm
|
|
39
|
+
yarn add @mherod/get-cookie # or yarn
|
|
56
40
|
```
|
|
57
41
|
|
|
58
|
-
|
|
42
|
+
## Common Use Cases ๐ฏ
|
|
59
43
|
|
|
60
|
-
|
|
44
|
+
- ๐ Get auth cookies for API testing
|
|
45
|
+
- ๐ Debug cookie issues across browsers
|
|
46
|
+
- ๐ค Automate cookie extraction
|
|
47
|
+
- ๐งช Use real cookies in integration tests
|
|
61
48
|
|
|
62
|
-
|
|
49
|
+
## Basic Usage Examples ๐ก
|
|
63
50
|
|
|
64
|
-
|
|
51
|
+
### CLI
|
|
65
52
|
|
|
66
53
|
```bash
|
|
67
|
-
# Get
|
|
54
|
+
# Get specific cookie
|
|
68
55
|
get-cookie auth example.com
|
|
69
56
|
|
|
70
|
-
#
|
|
71
|
-
get-cookie % example.com
|
|
72
|
-
|
|
73
|
-
# Get cookies with output formatting
|
|
57
|
+
# Pretty print
|
|
74
58
|
get-cookie auth example.com --render
|
|
75
|
-
get-cookie auth example.com --dump-grouped
|
|
76
59
|
|
|
77
|
-
#
|
|
60
|
+
# From URL
|
|
78
61
|
get-cookie --url https://example.com/path
|
|
79
62
|
```
|
|
80
63
|
|
|
81
|
-
### Node.js
|
|
82
|
-
|
|
83
|
-
Basic usage:
|
|
84
|
-
|
|
85
|
-
```typescript
|
|
86
|
-
import { getCookie } from "@mherod/get-cookie";
|
|
87
|
-
|
|
88
|
-
// Get a specific cookie
|
|
89
|
-
const authCookies = await getCookie({
|
|
90
|
-
name: "auth",
|
|
91
|
-
domain: "example.com",
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
// Get all cookies for a domain
|
|
95
|
-
const allCookies = await getCookie({
|
|
96
|
-
name: "%",
|
|
97
|
-
domain: "example.com",
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
// Get cookies from multiple specifications
|
|
101
|
-
import { comboQueryCookieSpec } from "@mherod/get-cookie";
|
|
102
|
-
|
|
103
|
-
const cookies = await comboQueryCookieSpec(
|
|
104
|
-
[
|
|
105
|
-
{ name: "session", domain: "api.example.com" },
|
|
106
|
-
{ name: "auth", domain: "auth.example.com" },
|
|
107
|
-
],
|
|
108
|
-
{
|
|
109
|
-
removeExpired: true,
|
|
110
|
-
limit: 10,
|
|
111
|
-
},
|
|
112
|
-
);
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
### Advanced Usage ๐ง
|
|
116
|
-
|
|
117
|
-
Using browser-specific strategies:
|
|
64
|
+
### Node.js
|
|
118
65
|
|
|
119
66
|
```typescript
|
|
120
|
-
import {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
"
|
|
136
|
-
|
|
137
|
-
);
|
|
67
|
+
import { getCookie, type CookieSpec } from "@mherod/get-cookie";
|
|
68
|
+
|
|
69
|
+
try {
|
|
70
|
+
// Get specific cookie
|
|
71
|
+
const authCookie = await getCookie({
|
|
72
|
+
name: "auth",
|
|
73
|
+
domain: "example.com",
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
// Get multiple cookies
|
|
77
|
+
const cookies = await getCookie({
|
|
78
|
+
name: "%", // all cookies
|
|
79
|
+
domain: "example.com",
|
|
80
|
+
});
|
|
81
|
+
} catch (error) {
|
|
82
|
+
console.error("Failed:", error);
|
|
83
|
+
}
|
|
138
84
|
```
|
|
139
85
|
|
|
140
|
-
|
|
86
|
+
## Features โจ
|
|
141
87
|
|
|
142
|
-
|
|
143
|
-
|
|
88
|
+
- ๐ **Multi-Browser Support**:
|
|
89
|
+
- Chrome (macOS)
|
|
90
|
+
- Firefox (macOS, Linux)
|
|
91
|
+
- Safari (macOS)
|
|
92
|
+
- ๐ **Secure**: Browser-specific encryption handling
|
|
93
|
+
- ๐ **TypeScript Ready**: Full type safety with exported type definitions
|
|
94
|
+
- ๐ฏ **Flexible Querying**: Search by name, domain, or use wildcards
|
|
95
|
+
- ๐ **Multiple Output Formats**: JSON, rendered, or grouped results
|
|
96
|
+
- ๐ฅ **Profile Support**: Chrome and Firefox multi-profile support
|
|
144
97
|
|
|
145
|
-
|
|
146
|
-
const specs = cookieSpecsFromUrl("https://example.com/dashboard");
|
|
147
|
-
const cookies = await comboQueryCookieSpec(specs);
|
|
148
|
-
```
|
|
98
|
+
โ ๏ธ **Note: Platform support varies by browser. See our [Platform Support Guide](https://mherod.github.io/get-cookie/guide/platform-support.html) for details.**
|
|
149
99
|
|
|
150
100
|
## Output Formats ๐
|
|
151
101
|
|
|
@@ -165,6 +115,15 @@ get-cookie auth example.com --render
|
|
|
165
115
|
get-cookie auth example.com --dump-grouped
|
|
166
116
|
```
|
|
167
117
|
|
|
118
|
+
## Documentation ๐
|
|
119
|
+
|
|
120
|
+
Full docs at [mherod.github.io/get-cookie](https://mherod.github.io/get-cookie/)
|
|
121
|
+
|
|
122
|
+
- API Reference
|
|
123
|
+
- Advanced Usage
|
|
124
|
+
- TypeScript Types
|
|
125
|
+
- [Security Guide](https://mherod.github.io/get-cookie/guide/security.html) โ ๏ธ
|
|
126
|
+
|
|
168
127
|
## Contributing ๐ค
|
|
169
128
|
|
|
170
129
|
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
|
|
@@ -173,6 +132,6 @@ Contributions are welcome! Please feel free to submit a Pull Request. For major
|
|
|
173
132
|
|
|
174
133
|
This project is licensed under the MIT License - see the LICENSE file for details.
|
|
175
134
|
|
|
176
|
-
##
|
|
135
|
+
## Known Limitations ๐ง
|
|
177
136
|
|
|
178
|
-
|
|
137
|
+
For a comprehensive list of limitations and known issues, please see our [Known Limitations Guide](https://mherod.github.io/get-cookie/guide/limitations.html).
|