tough-cookie-document-store
v1.0.0
Published
tough-cookie store use document.cookie adapter
Downloads
5
Maintainers
Readme
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)