jarson

1.0.0 • Public • Published

jarson

Convert (serialize / deserialize) request / tough-cookie cookie jars to and from JSON.

npm install --save jarson
'use strict';

var JarSON = require('jarson')
  , request = require('request')
  , jar = request.jar()
  ;

  request({
    url: 'https://example.com/login'
  , method: 'POST'
  , data: { username: 'bob', password: 'secret' }
  , jar: jar
  });

  // to save to disk, for example
  var str = JSON.stringify(JarSON.toJSON(jar));

  // to retrieve from disk
  var jar = JarSON.fromJSON(JSON.parse(str));

  request({
    url: 'https://example.com/me/profile'
  , method: 'GET'
  , jar: jar
  })

Hopefully this is just a temporary fix for these issues and the required fixes will be applied in the near future.

Package Sidebar

Install

npm i jarson

Weekly Downloads

4

Version

1.0.0

License

Apache2

Last publish

Collaborators

  • coolaj86