Browserify-compatible module to get and set cookies in the browser
JavaScript HTML
Switch branches/tags
Latest commit bcd1d59 Jun 29, 2016 @yoshuawuyts yoshuawuyts 0.2.0
Failed to load latest commit information.
example/getset initial thing Sep 28, 2011
README.markdown Fix broken link to node-browserify Mar 15, 2015
index.js Adding Secure and Domain options Sep 17, 2015
package.json 0.2.0 Jun 29, 2016



Set and get cookies in the browser or in node with document.

In your browser code with browserify:

var cookie = require('cookie-cutter');
var times = parseInt(cookie.get('times'), 10) || 0;
cookie.set('times', times + 1);

and times will increment every time the page is reloaded.


var cookie = require('cookie-cutter');


Return a new cookie object with .get() and .set() operating on document.

document.cookie should be a non-referentially transparent setter/getter combo like the DOM's variant where assignment with optional path and expiry creates a new cookie in the getter as a key=value pair.


Return the cookie value for key.

cookie.set(key, value, opts={})

Set the cookie at key to value with optional parameters expires and path.

To unset a cookie, use a date in the past, ex: { expires: new Date(0) }


With npm do:

npm install cookie-cutter