New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

biskviit

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

biskviit

Yet another module for http cookie handling

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

biskviit

Yet another node module for handling http cookies. This module parses Set-Cookie header, stores the data to memory and returns valid value for Cookie header once needed based on the stored cookie data.

NB Requires iojs or Node v4+ to support some ES6 features used by this module. Might work with older Node versions as well but not tested

Usage

Install from npm

npm install biskviit --save

Require as Biskviit

var Biskviit = require('biskviit');

Create a cookie managing biskviit instance

var biskviit = new Biskviit(options);

Where

  • options is an optional options object with the following properties:
    • sessionTimeout is the amount in seconds for default session length, used for cookies without an expire argument

Example

var Biskviit = require('biskviit');
var biskviit = new Biskviit({
    sessionTimeout: 5 * 60 // expire cookies after 5 minutes
});

set

To add new cookies to the storage use set

biskviit.set(cookieString, url)

Where

  • cookieString is the value from the Set-Cookie: header
  • url is the currently open URL that sent the cookie header

Example

biskviit.set('theme=light', 'http://example.com/');
biskviit.set('sessionToken=abc123; Expires=Wed, 09 Jun 2021 10:18:14 GMT', 'http://example.com/');

get

To list all available cookies for a specified URL use get

var cookiesString = biskviit.get(url);

Where

  • url is the URL the cookies are required for

Example

var cookiesString = biskviit.get('http://example.com/');
// theme=light; sessionToken=abc123

list

If you need to filter cookies as objects, use list

var cookiesString = biskviit.list(url);

Where

  • url is the URL the cookies are required for

Example

var cookiesString = biskviit.list('http://example.com/');
// [{key: 'theme', value: 'light', expires: ...}, {key: 'sessionToken', value: 'abc123', expires: ...}]

License

MIT

Keywords

FAQs

Package last updated on 14 Sep 2015

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