tough-cookie-document-store
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

tough-cookie-document-store

tough-cookie store use document.cookie adapter

npm install tough-cookie tough-cookie-document-store

usage

import DocumentCookieStore from 'tough-cookie-document-store';
import * as toughCookie from 'tough-cookie';

for node.js

u can make a document ny jsdom

import { createJSDOM } from 'jsdom-extra';
let jsdom = createJSDOM();
let document = jsdom.document;

demo

let store: DocumentCookieStore;

if (typeof document != 'undefined' && document)
{
	// if ur document not a global, this can help
	store = new DocumentCookieStore(document);
}
else
{
	// will auto use global document
	store = new DocumentCookieStore();
}

let jar = new toughCookie.CookieJar(store);

console.log(jar);

// ... anything u wanna do

other options

new DocumentCookieStore(document, another new toughCookie.Store for cache)

Package Sidebar

Install

npm i tough-cookie-document-store

Weekly Downloads

1

Version

1.0.0

License

ISC

Unpacked Size

17.9 kB

Total Files

14

Last publish

Collaborators

  • bluelovers