README.md•1.85 kB
# 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://david-dm.org/ivanmarban/tough-cookie-file-store)
[](https://standardjs.com)
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=4DELQKMDMDQY4)
## Installation
``` sh
$ npm install tough-cookie-file-store
```
## Usage
``` js
const { CookieJar, Cookie } = require('tough-cookie')
const CookieFileStore = require('tough-cookie-file-store').FileCookieStore
const cookieJar = new CookieJar(new CookieFileStore('./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