![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@types/tough-cookie
Advanced tools
TypeScript definitions for 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.
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');
The cookie package is a simple, lightweight option for parsing and serializing cookies in Node.js and browser environments. It does not offer the same level of complexity or management capabilities (such as a cookie jar) as tough-cookie but is easier to use for basic tasks.
js-cookie is a simple, easy-to-use library for handling cookies in the browser. It provides a straightforward API for cookie manipulation, lacking the server-side capabilities and detailed configuration options of tough-cookie.
npm install --save @types/tough-cookie
This package contains type definitions for tough-cookie (https://github.com/salesforce/tough-cookie).
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/tough-cookie.
These definitions were written by Leonard Thieu, LiJinyao, and Michael Wei.
FAQs
TypeScript definitions for tough-cookie
The npm package @types/tough-cookie receives a total of 14,670,774 weekly downloads. As such, @types/tough-cookie popularity was classified as popular.
We found that @types/tough-cookie demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.