cookiex
v1.0.0
Published
HTTP cookie parser and serializer for javascript
Readme
Cookiex
HTTP cookie parser and serializer for javascript
Usage
$ npm install cookiex --saveimport and use it like below:
const cookiex = require('cookiex');
cookiex.set('name', 'obama', 3, 'baidu.com', '/', false);
cookie.get('name'); // return 'obama'
cookie.remove('name') // unset cookieor if you import it as script link:
<script src='./index.js'></script>cookiex will be expose in global scope.
cookiex.set('name', 'obama', 3, 'baidu.com', '/', false);
cookie.get('name'); // return 'obama'
cookie.remove('name') // unset cookieAPI
const cookiex = require('cookiex');cookiex.set(name)
namethe cookie name you want parse.
cookie.get(name, value, domain, expire, path, secure)
nameCookie name.valueCookie value.expireSpecifies the number (in days) to be the value for the Max-Age Set-Cookie attribute.domainSpecifies the value for the Domain Set-Cookie attribute. By default, no domain is set, and most clients will consider the cookie to apply to only the current domain.pathSpecifies the value for the Path Set-Cookie attribute.secureSpecifies the boolean value for the [Secure Set-Cookie attribute],when setting this to true, as compliant clients will not send the cookie back to the server in the future if the browser does not have an HTTPS connection.
