Node Cookie Manager for Firefox, read / write cookie from sqlite db
npm i firefox-cookie
// Search for the "default" profile in Firefox implicitly https://support.mozilla.org/gl/questions/1264072
const FirefoxCookie = require('firefox-cookie');
const FFCookie = new FirefoxCookie();
// Search for the "default-release" new profile in Firefox explicitly (or any other profile you give as parameter)
const FirefoxCookie = require('firefox-cookie');
const FFCookie = new FirefoxCookie("default-release");
// Reading cookie
const cookie = await FFCookie.getCookie('arshad.com');
// Inserting cookie
const DATA = [
{
'baseDomain': 'arshad.com',
'originAttributes': '',
'name': 'arshad',
'value': 'arshad-test-cookie',
'host': 'arshad.com',
'path': '/root',
'expiry': 1,
'lastAccessed': 111111111,
'creationTime': 10001110,
'isSecure': 1,
'isHttpOnly': 0,
'inBrowserElement': 0,
'sameSite': 0,
}
];
await FFCookie.setCookie(DATA);
-
getCookie(path)
- Returns cookie json from database for the input path
- Params
- path (String)
- Params
- Returns cookie json from database for the input path
-
setCookie(cookies)
- Adds all the input cookies into the sqlite database
- Params
- cookies (Array of cookies object)
- Params
- Adds all the input cookies into the sqlite database
-
removeCookie(domain)
- Removes all records matching the domain.
-
It uses
like
condition (%domain%
) so anything matching the pattern will be removed- Params
- path (String)
- Params
Interested in contributing to this project? You can log any issues or suggestion related to this library here
Read our contributing guide on getting started with contributing to the codebase
Thank you to all the contributors who have helped us in making this project better 🙌