Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cookie

Package Overview
Dependencies
Maintainers
2
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cookie

HTTP server cookie parsing and serialization

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
62M
increased by5.01%
Maintainers
2
Weekly downloads
 
Created

What is cookie?

The 'cookie' npm package is a simple, lightweight utility for parsing and serializing cookies in Node.js. It is designed to work with the HTTP server's cookie headers to read and write cookies on the server side.

What are cookie's main functionalities?

Parse Cookie Header

This feature allows you to parse the Cookie header string into an object where each property is a cookie name and its value is the cookie value. It automatically handles URL-encoded cookie values.

const cookie = require('cookie');
const cookies = cookie.parse('foo=bar; equation=E%3Dmc%5E2');

Serialize Cookie

This feature lets you serialize a cookie name-value pair into a Set-Cookie header string with optional attributes such as `HttpOnly`, `Max-Age`, and others. It is useful for setting cookies in HTTP responses.

const cookie = require('cookie');
const serializedCookie = cookie.serialize('foo', 'bar', { httpOnly: true, maxAge: 60 * 60 * 24 });

Other packages similar to cookie

Keywords

FAQs

Package last updated on 20 Nov 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc