0.1.0 • Published 6 years ago

jar-got v0.1.0

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

jar-got

Wrapper for got to persisting cookies

npm npm

Install

yarn add jar-got

Usage

Basic

const jarGot = require('jar-got')
const got = jarGot();

(async _ => {
  await got('http://google.co.kr') // First, stores the response set-cookie.
  await got('http://google.co.kr') // Second, request with the stored cookies.
})()

Save and restore

// serialize
const saved = got.save();

// deserialize
const restoredGot = jarGot.restore(saved)

Using existing cookie jar.

const got1 = jarGot()

const got2 = jarGot(got1.jar) // got1.jar === got2.jar

License

MIT