Skip to content

iCasa/tough-cookie-file-store

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tough-cookie-file-store

NPM

Another file store for tough-cookie module.

The main purpose of this project is to have a published module with the original functionality of tough-cookie-filestore plus various fixes, improvements and features that I found useful.

Installation

$ npm install tough-cookie-file-store

Usage

var cookieStore = require('tough-cookie-file-store');
var CookieJar = require('tough-cookie').CookieJar;
var jar = new CookieJar(new cookieStore('./cookie.json'));

/* check if cookie is empty or expired */
var cookieStore	= require('tough-cookie-file-store');
var cookieInstance = new cookieStore('./cookie.json');
cookieInstance.isExpired() // will return True if the cookie is expired
cookieInstance.isEmpty() // will return True is cookie is empty

/* request example */
var cookieStore = require('tough-cookie-file-store');
var j = request.jar(new cookieStore('./cookie.json'));
request = request.defaults({ jar : j })
request('http://www.google.com', function() {
  request('http://images.google.com')
})

Credits

tough-cookie-filestore module: @mitsuru

fixes/improvements: @sarkian @mudkipme @vladh

expired feature: @zhzehong

License

MIT

About

Another file store for tough-cookie module.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%