Create a new cookie from a name and value and optional options
Symbol
Cookie.from
Referenced types
interface CookieInit
class Cookie
A class for working with a single cookie
const cookie = new Bun.Cookie("name", "value");
console.log(cookie.toString()); // "name=value; Path=/; SameSite=Lax"
Whether the cookie is expired
Serialize the cookie to a string
const cookie = Bun.Cookie.from("session", "abc123", { domain: "example.com", path: "/", secure: true, httpOnly: true }).serialize(); // "session=abc123; Domain=example.com; Path=/; Secure; HttpOnly; SameSite=Lax"
Serialize the cookie to a JSON object
Serialize the cookie to a string
Alias of Cookie.serialize
Create a new cookie from a name and value and optional options