You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

request-persistent

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

request-persistent

An extension to request that allows you to serialize and deserialize your cookie jars to JSON for future use.

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

request-persistent

A simple module to add a toJSON function and a fromJSON function to cookie jars created with request.jar().

usage

var fs = require('fs');
var request('request');
require('request-persistent')(request);
var jar;
if (fs.existsSync('cookies.json')) {
  jar = request.jar.fromJSON(fs.readFileSync('cookies.json'));
  // can also be an object, request.jar.fromJSON(require('./cookies')) would work
} else {
  jar = request.jar();
}
request({
  jar: jar
  method: 'POST',
  url: 'http://website.com/login',
  form: {
    user: 'username',
    pass: 'password'
  },
}, function (err, resp, body) {
  fs.writeFileSync('cookies.json', jar.toJSON());
});

Keywords

persistent

FAQs

Package last updated on 07 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