tough-cookie.cookiejar.deserialize.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, callback: Callback<CookieJar>): void;

Parameters

Parameter

Type

Description

strOrObj

string | object

A JSON string or object representing the deserialized cookies.

callback

Callback<CookieJar>

A function to call after the CookieJar has been deserialized.

Returns:

void

Remarks

  • When no Store is provided, a new MemoryCookieStore will be used.

  • As a convenience, if strOrObj is a string, it is passed through JSON.parse first.