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

fetch-cookie

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fetch-cookie

Decorator for a `fetch` function to support automatic cookies.

  • 0.7.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
271K
decreased by-60.22%
Maintainers
1
Weekly downloads
 
Created

What is fetch-cookie?

The fetch-cookie npm package is a wrapper around the Fetch API that adds automatic handling of cookies. It allows you to manage cookies in a more convenient way when making HTTP requests, which is particularly useful for maintaining session state across multiple requests.

What are fetch-cookie's main functionalities?

Automatic Cookie Handling

This feature allows you to automatically handle cookies when making HTTP requests. The cookies are stored and sent with subsequent requests to the same domain, making it easier to manage session state.

const fetch = require('fetch-cookie/node-fetch')(require('node-fetch'));

fetch('https://example.com')
  .then(res => res.text())
  .then(body => console.log(body));

Custom Cookie Jar

You can use a custom cookie jar to manage cookies. This is useful if you need to share cookies between different parts of your application or if you need to persist cookies between sessions.

const fetch = require('fetch-cookie/node-fetch')(require('node-fetch'));
const tough = require('tough-cookie');
const cookieJar = new tough.CookieJar();

fetch('https://example.com', { cookieJar })
  .then(res => res.text())
  .then(body => console.log(body));

Integration with Node.js and Browsers

The package can be used both in Node.js and in browser environments, making it versatile for different types of applications.

const fetch = require('fetch-cookie/node-fetch')(require('node-fetch'));

fetch('https://example.com')
  .then(res => res.text())
  .then(body => console.log(body));

Other packages similar to fetch-cookie

FAQs

Package last updated on 28 Sep 2017

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