tough-cookie.cookiejar.deserialize_2.md
July 9, 2025 ยท View on GitHub
Home > tough-cookie > CookieJar > deserialize
CookieJar.deserialize() method
A new CookieJar is created and the serialized Cookie values are added to the underlying store. Each Cookie is added via store.putCookie(...) in the order in which they appear in the serialization.
Signature:
static deserialize(strOrObj: string | object, store?: Store): Promise<CookieJar>;
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
strOrObj |
string | object |
A JSON string or object representing the deserialized cookies. |
|
store |
(Optional) The underlying store to persist the deserialized cookies into. |
Returns:
Promise<CookieJar>
Remarks
-
When no Store is provided, a new MemoryCookieStore will be used.
-
As a convenience, if
strOrObjis a string, it is passed throughJSON.parsefirst.