Socket
Socket
Sign inDemoInstall

@types/tough-cookie

Package Overview
Dependencies
0
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @types/tough-cookie

TypeScript definitions for tough-cookie


Version published
Weekly downloads
11M
decreased by-0.23%
Maintainers
1
Install size
13.2 kB
Created
Weekly downloads
 

Package description

What is @types/tough-cookie?

The @types/tough-cookie package provides TypeScript type definitions for the tough-cookie library, which is a robust HTTP cookie parsing and serialization library. This package doesn't add any functionality on its own but allows developers using TypeScript to work with tough-cookie in a type-safe manner, offering autocompletion and type checking for the tough-cookie API.

What are @types/tough-cookie's main functionalities?

Cookie parsing

This feature allows for the parsing of a cookie string into a Cookie object, which can then be manipulated or inspected in a type-safe manner.

import { Cookie } from 'tough-cookie';

const cookie = Cookie.parse('key=value; expires=Fri, 31 Dec 9999 23:59:59 GMT;');

Cookie serialization

This feature enables the serialization of a Cookie object back into a string format, which can be used in HTTP headers.

import { Cookie } from 'tough-cookie';

const cookie = new Cookie({
  key: 'key',
  value: 'value',
  expires: new Date('9999-12-31T23:59:59.000Z')
});
const serializedCookie = cookie.toString();

Cookie jar management

This feature provides a way to manage a collection of cookies relevant to specific domains and paths, allowing for easy retrieval and storage of cookies across HTTP requests.

import { CookieJar } from 'tough-cookie';

const jar = new CookieJar();
jar.setCookieSync('key=value; Domain=example.com; Path=/;', 'http://example.com');
const cookies = jar.getCookiesSync('http://example.com');

Other packages similar to @types/tough-cookie

Readme

Source

Installation

npm install --save @types/tough-cookie

Summary

This package contains type definitions for tough-cookie (https://github.com/salesforce/tough-cookie).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/tough-cookie.

Additional Details

  • Last updated: Tue, 07 Nov 2023 20:08:00 GMT
  • Dependencies: none

Credits

These definitions were written by Leonard Thieu, LiJinyao, and Michael Wei.

FAQs

Last updated on 07 Nov 2023

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc