@steipete/sweet-cookie
v0.2.0
Published
Inline-first browser cookie extraction for local tooling (no native addons).
Readme
@steipete/sweet-cookie
Inline-first browser cookie extraction for local tooling (no native addons).
Supports:
- Inline payloads (JSON / base64 / file) — most reliable path.
- Local browser reads (best effort): Chrome, Edge, Firefox, Safari (macOS).
- On macOS, the
chromebackend checks Chrome and Brave roots by default.
Install:
npm i @steipete/sweet-cookieUsage:
import { getCookies, toCookieHeader } from "@steipete/sweet-cookie";
const { cookies, warnings } = await getCookies({
url: "https://example.com/",
names: ["session", "csrf"],
browsers: ["chrome", "edge", "firefox", "safari"],
});
for (const w of warnings) console.warn(w);
const cookieHeader = toCookieHeader(cookies, { dedupeByName: true });macOS-specific Chromium targeting:
await getCookies({
url: "https://example.com/",
browsers: ["chrome"],
chromiumBrowser: "brave",
});Notes:
chromiumBrowserpins the macOSchromebackend tochrome,brave,arc, orchromium.- Inline payloads win first; otherwise local backends run in declared order.
- On Linux, Chromium safe-storage overrides also support
SWEET_COOKIE_BRAVE_SAFE_STORAGE_PASSWORD.
Docs + extension exporter: see the repo root README.
