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

cookiejar

Package Overview
Dependencies
Maintainers
2
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cookiejar

simple persistent cookiejar system

  • 2.1.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8.4M
increased by4.97%
Maintainers
2
Weekly downloads
 
Created

What is cookiejar?

The npm package 'cookiejar' is a utility for handling web cookies in Node.js. It allows for the creation, retrieval, manipulation, and deletion of cookies, making it easier to manage client-side state information across web requests.

What are cookiejar's main functionalities?

Create and manage cookies

This feature allows the creation and management of cookies. The code sample demonstrates how to create a new cookie jar and set a cookie with an expiration date.

const CookieJar = require('cookiejar');
const jar = new CookieJar();
const cookie = jar.setCookie('key=value; expires=Wed, 09 Jun 2021 10:18:14 GMT');

Retrieve cookies

This feature enables the retrieval of cookies based on specific criteria such as domain and path. The code shows how to retrieve a cookie from the jar that matches the specified domain and path.

const CookieJar = require('cookiejar');
const jar = new CookieJar();
jar.setCookie('key=value; path=/; domain=example.com');
const cookie = jar.getCookie('key', {domain: 'example.com', path: '/'});

Parse and serialize cookies

This feature deals with parsing cookies from request headers and serializing them for HTTP headers. The code illustrates how to serialize all cookies in the jar for use in an HTTP request.

const CookieJar = require('cookiejar');
const CookieAccessInfo = CookieJar.CookieAccessInfo;
const jar = new CookieJar();
jar.setCookie('key=value; path=/; domain=example.com');
const serializedCookies = jar.getCookies(CookieAccessInfo.All).toValueString();

Other packages similar to cookiejar

FAQs

Package last updated on 29 Sep 2021

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