Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
cookie-muncher
Advanced tools
A lightweight and typesafe package for manipulating cookies in NodeJS and the browser.
✅ Lightweight
✅ Easy to use
✅ Unit tested
✅ Typesafe
✅ Compatible with NodeJS & browsers
✅ ES module & CommonJS compatible
You can install Cookie Muncher via NPM, Yarn or PNPM.
npm install cookie-muncher
yarn add cookie-muncher
pnpm install cookie-muncher
serializeCookie(cookie: Cookie, options?: CookieOptions): string
Serialize a cookie into a string.
import type { Cookie, CookieOptions } from "cookie-muncher";
import { serializeCookie, CookieMaxAge } from "cookie-muncher";
const cookie: Cookie = {
name: "myCookie",
value: "myValue",
};
const options: CookieOptions = {
maxAge: CookieMaxAge.TwoWeeks,
path: "/",
secure: true,
sameSite: "Strict",
};
const serializedCookie = serializeCookie(cookie, options);
console.log(serializedCookie);
// Output: "myCookie=myValue; Max-Age=3600; Path=/; Secure; SameSite=Strict"
parseCookies(cookies: string): Cookie[]
Parse a string of cookies into an array of cookie objects.
import { parseCookies } from "cookie-muncher";
const cookies = "myCookie1=myValue1; myCookie2=myValue2";
const parsedCookies = parseCookies(cookies);
console.log(parsedCookies);
// Output: [{ name: "myCookie1", value: "myValue1" }, { name: "myCookie2", value: "myValue2" }]
This package is MIT licensed.
FAQs
Effortless cookie management for server and browser
The npm package cookie-muncher receives a total of 135 weekly downloads. As such, cookie-muncher popularity was classified as not popular.
We found that cookie-muncher demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.