Registry / storage / tough-cookie-redisstore

tough-cookie-redisstore

JSON →
library0.0.4jsnpmunverified

A Redis-backed cookie store for the tough-cookie library, allowing persistent cookie storage across Node.js sessions. Version 0.0.4 is stable but appears to have no recent updates. It is based on the earlier tough-cookie-filestore pattern, providing a simple store constructor that takes a Redis key name. This package is ultra-lightweight but lacks active maintenance, TypeScript definitions, and modern async/await patterns. It relies on the synchronous tough-cookie store interface and may not be compatible with newer tough-cookie versions that have moved to async API.

npm install tough-cookie-redisstore
INSTALL
IMPORT
SIG · TOUGH-COOKIE-REDIS
T
tough-cookie-redisstore
storagejavascriptv0.0.4
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

RedisCookieStore
var RedisCookieStore = require('tough-cookie-redisstore');
import RedisCookieStore from 'tough-cookie-redisstore';
This package does not support ES modules; use CommonJS require only.
CookieJar
var CookieJar = require('tough-cookie').CookieJar;
import { CookieJar } from 'tough-cookie';
tough-cookie supports both ESM and CJS, but this is typically used with require to match the store.
new CookieJar(new RedisCookieStore('key'))
var jar = new CookieJar(new RedisCookieStore('username-cookie-key'));
var jar = new CookieJar(new RedisCookieStore({path: '/tmp/cookies.txt'}));
The constructor takes a string key, not an options object. The path option mentioned in the README is from the original file store, not applicable here.

Creates a Redis-backed cookie jar, sets a cookie, and retrieves it. Uses callbacks as the typical pattern for this version.

var RedisCookieStore = require('tough-cookie-redisstore'); var CookieJar = require('tough-cookie').CookieJar; // Create a cookie jar backed by Redis with key 'myapp-cookies' var jar = new CookieJar(new RedisCookieStore('myapp-cookies')); // Set a cookie var cookie = { key: 'test', value: '123', domain: 'example.com', path: '/' }; jar.setCookie(JSON.stringify(cookie), 'http://example.com', function(err, cookie) { if (err) console.error(err); else console.log('Cookie set:', cookie); }); // Get cookies jar.getCookies('http://example.com', function(err, cookies) { if (err) console.error(err); else console.log('Cookies:', cookies); });
Debug
Known issues
gotchaThe store uses a Redis key (string) in the constructor, not an options object. The README mentions 'path' but that is from the original file store and is ignored.
fix
Pass a string key: new RedisCookieStore('my-key')
affects: >=0.0.4
breakingtough-cookie version 4.x changed the store interface from sync to async. This package may not work with tough-cookie >=4.0.0.
fix
Use tough-cookie <4.0.0 or check compatibility.
affects: >=0.0.4
gotchaThis package does not support ESM import syntax. Using 'import' will fail.
fix
Use CommonJS require: const RedisCookieStore = require('tough-cookie-redisstore');
affects: >=0.0.4
deprecatedThe package has not been updated since 2016 and may contain unaddressed issues or security vulnerabilities.
fix
Consider alternative packages like 'tough-cookie-filestore' or implement your own async store.
affects: >=0.0.4
Errors
Common errors & fixes
Error: Cannot find module 'tough-cookie-redisstore'
The package is not installed or is missing from node_modules.
fix
Run 'npm install tough-cookie-redisstore' to install it.
TypeError: RedisCookieStore is not a constructor
Using ESM import syntax with a CommonJS-only package.
fix
Use require: const RedisCookieStore = require('tough-cookie-redisstore');
TypeError: jar.setCookie is not a function
tough-cookie v4 changed setCookie to return a Promise, but this store expects callback-based API.
fix
Use tough-cookie v3 or earlier, or wrap the store in an adapter.
Upgrade
Version history
0.0.4latest on npm
Audit
Dependencies
tough-cookierequiredrequired to create CookieJar and use the cookie store
Agent activity
23 hits · last 30 days
node
22
Resources
tough-cookie-redisstore — npm install tough-cookie-redisstore · libregistry