JSPM

binary-cookies

0.1.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 12
  • Score
    100M100P100Q69639F

Binary cookie file parser

Package Exports

  • binary-cookies

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (binary-cookies) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

node-binary-cookies

Binary cookies parser for Node.

Some Apple browsers like Safari and Mobile Safari store their cookies in a .binarycookie format that is hard to parse. Node to the rescue! Say you have a file at /my/path/to/Cookies.binarycookies. You can parse it like so:

var CookieParser = require('./cookies')
  , cookiePath = "/my/path/to/Cookies.binarycookies";

CookieParser.parse(cookiePath, function(err, cookies) {
  console.log(cookies[0]);
});

This will output something like this:

{
    flags: 0,
    expiration: new Date("Thu Apr 02 2015 14:55:59 GMT-0700 (PDT)"),
    creation: new Date("Tue Apr 02 2013 14:56:00 GMT-0700 (PDT)"),
    url: '.apple.com',
    name: 's_pathLength',
    path: '/',
    value: 'homepage%3D1%2C'
}

This should all be self-explanatory except flags:

Flag Meaning
0 No flags
1 Secure cookie
4 HttpOnly cookie
5 Secure & HttpOnly

Have fun! I wrote this for Appium, check it out!

Acknowledgements

I learned about the spec from this blog entry. Thanks Internet dude!