Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

simple-cookie

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-cookie

Simple cookie parser & serializer

  • 1.0.15
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.1K
increased by6.24%
Maintainers
1
Weekly downloads
 
Created
Source

simple cookie serializer & parser for node.js

NPM Version

install

npm install simple-cookie

usage

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

var cookieObject = {
	name: 'cookieName',
	value: 'cookie value',
	expires: (new Date()).valueOf() + 500000,
	path: '/',
	domain: 'domain.com',
	httponly: false,
	secure: true,
	samesite: 'cookie samesite'
}

What is cookieObject:

name String : cookie name

value String : cookie value

expires DateString | Number | Date (optional) : expire date (default type is Date), value will be used as a parameter in new Date. e.g. new Date(yourDateString).

path String (optional) : cookie path, defaults to /

domain String (optional) : cookie domain

httponly Boolean (optional) : defaults to false

secure Boolean (optional) : defaults to false

samesite String : samesite

##methods

var cookieString = cookie.stringify( cookieObject );
// cookieName=cookie%20value; Expires: Sat, 15-Aug-2015 17:41:05 GMT; Max-Age: 31449600; Path=/; domain=domain.com; secure; samesite=None


cookie.parse( cookieString  [, defaultPath]  [, defaultDomain]  );
// will create object like the 'cookieObject'


cookie.tokenize([
	{name:'cookie1', value: 'cvalue1'},
	{name:'cookie2', value: 'cvalue2'},
	{name:'cookie3', value: 'cvalue3'}
]);
// cookie1=cvalue1; cookie2=cvalue2; cookie3=cvalue3

cheers,

jujiyangasli.com

Keywords

FAQs

Package last updated on 22 Apr 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc