# Cookie
Save, retrieve, and delete cookies with optional expiration in years, months, and days.
Home
/
Cookie
Cookie Methods
Cookie provides methods to manage browser cookies easily with full control over expiration, scope, and attributes.
MethodDescriptionparameters
save(value, options)
Saves a cookie with custom expiration, path, secure flag, and SameSite attribute.`value: any, options: CookieOptions`
get()
Retrieves and parses the cookie value. Returns a promise.`none`
remove()
Deletes the cookie by setting an expired date.`none`
Cookie Options
These options can be passed to the save() method to control cookie behavior.
MethodDescriptionparameters
duration
Expiration of the cookie in years, months, and/or days.`{ years?: number, months?: number, days?: number }`
path
Path where the cookie is available. Defaults to '/'`string`
secure
If true, cookie will only be sent over HTTPS.`boolean`
sameSite
Controls cross-site access. Can be 'Strict', 'Lax', or 'None'`'Strict' | 'Lax' | 'None'`
#
save()
Use save() to store a cookie with custom expiration.
React / Next.js
#
get()
Use get() to retrieve and parse a cookie value.
React / Next.js
#
remove()
Use remove() to delete the cookie immediately.
React / Next.js