Package Exports
- @p0xz/cookiejar
- @p0xz/cookiejar/dist/index.js
- @p0xz/cookiejar/dist/index.mjs
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@p0xz/cookiejar) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
CookieJar
Lightweight cookiejar library for node.js
cookiejar is simple & lightweight node.js library built for having a place where to store your cookies
Features
- ⚡️ Fast Cookie Parsing: Efficiently parses raw cookie strings.
- 🗄️ Cookie Jar Management: Stores and manages multiple cookies.
- 🔎 Easy Cookie Retrieval: Retrieve cookies by name.
- ✅ TypeScript Support: Built-in type definitions.
- 🚀 Zero Dependencies: Lightweight and dependency-free.
Install
pnpm i @p0xz/cookiejarUsage
import cookiejar from "@p0xz/cookiejar";
const jar = new CookieJar();
const exampleCookie =
"sessionId=abc123; Domain=example.com; Path=/; Secure; HttpOnly; SameSite=Strict; Expires=Wed, 09 Jun 2025 10:18:14 GMT";
// it takes an array with cookie strings and then it will proccess them
jar.setCookies([exampleCookie]);
// returns 'sessionId' value
jar.getCookie("sessionId");Methods
Sets and initializes your cookies
setCookies(_cookies: Array<string>);Return cookies
This will return your cookies you've saved. There's also an option to return it in form of raw unparsed data or already processed.
By default it will return raw unparsed data
getCookies(formatted: boolean);Return specified cookie
This will return your desired cookie by name, if it exists.
getCookie(name: string);Clear cookies
Simply erases your cookies from array leaving it empty.
clearCookies();License
Copyright © 2025 cookieJar
This project is protected under the GNU AGPLv3 License. For more details, refer to the LICENSE file.