tough-cookie-file-store
Version:
A JSON file store for tough-cookie module
33 lines (25 loc) • 1.53 kB
Markdown
# tough-cookie-file-store
[](https://nodei.co/npm/tough-cookie-file-store/)
A JSON file store implementation for [tough-cookie][0] module
[](https://www.npmjs.com/package/tough-cookie-file-store)
[](https://npmcharts.com/compare/tough-cookie-file-store?minimal=true)
[](https://github.com/ivanmarban/tough-cookie-file-store/actions/workflows/tests.yml)
[](https://coveralls.io/github/ivanmarban/tough-cookie-file-store?branch=master)
[](https://standardjs.com)
## Installation
``` sh
$ npm install tough-cookie-file-store
```
## Usage
``` js
import { CookieJar, Cookie } from 'tough-cookie'
import FileCookieStore from 'tough-cookie-file-store'
const cookieJar = new CookieJar(new FileCookieStore('./cookie.json'))
const cookie = Cookie.parse('foo=bar; Domain=example.com; Path=/')
cookieJar.setCookie(cookie, 'http://example.com', function (error, cookie) {
console.log(cookie)
})
```
## License
MIT
[0]: https://github.com/salesforce/tough-cookie