CookieStorage - Web Storage Interface for Cookies

JSON →
library 6.1.0 ·javascript
verified Jun 7, 2026

cookie-storage provides a Web Storage API-compatible interface for browser cookies, implementing the same methods as localStorage/sessionStorage (getItem, setItem, removeItem, clear, key, length) with additional cookie-specific options like path, domain, expires, secure, and sameSite. Current stable version is 6.1.0, released in 2023. The library is lightweight, ships TypeScript definitions, and supports ESM imports. Unlike raw document.cookie manipulation, it offers a cleaner API and automatic cookie string encoding/decoding. It is ideal for cross-browser cookie management with a familiar storage interface, but note that cookie storage is limited to ~4KB per cookie and 20-50 cookies per domain.