šŸš€ Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more →
Socket
Sign inDemoInstall
Socket

@types/cookies

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/cookies

TypeScript definitions for cookies

0.9.0
ts4.6
ts4.7
ts4.8
ts4.9
ts5.0
ts5.1
ts5.2
ts5.3
ts5.4
ts5.5
ts5.6
ts5.7
ts5.8
ts5.9
latest
Source
npm
Version published
Weekly downloads
2.3M
4.51%
Maintainers
1
Weekly downloads
Ā 
Created

What is @types/cookies?

The @types/cookies package provides TypeScript type definitions for the 'cookies' npm package, which is used for handling browser cookies in Node.js applications. These type definitions allow TypeScript developers to use the 'cookies' package with type safety, ensuring that the methods and properties used are correctly typed according to the expected inputs and outputs.

What are @types/cookies's main functionalities?

Get Cookie

Retrieve the value of a cookie named 'LastVisit'. This feature is useful for accessing user-specific data stored in cookies, such as session tokens or user preferences.

import Cookies from 'cookies';
const cookies = new Cookies(req, res);
const lastVisit = cookies.get('LastVisit');

Set Cookie

Set a new cookie on the client's browser. This example sets a cookie named 'name' with the value 'value', and marks it as HTTP-only and secure, which are important flags for protecting cookies.

import Cookies from 'cookies';
const cookies = new Cookies(req, res);
cookies.set('name', 'value', { httpOnly: true, secure: true });

Other packages similar to @types/cookies

FAQs

Package last updated on 27 Jan 2024

Did you know?

Socket

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.

Install

Related posts