tough-cookie.cookiejar.clone.md

July 9, 2025 ยท View on GitHub

Home > tough-cookie > CookieJar > clone

CookieJar.clone() method

Produces a deep clone of this CookieJar. Modifications to the original do not affect the clone, and vice versa.

Signature:

clone(callback: Callback<CookieJar>): void;

Parameters

Parameter

Type

Description

callback

Callback<CookieJar>

A function to call when the CookieJar is cloned.

Returns:

void

Remarks

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

  • Transferring between store types is supported so long as the source implements .getAllCookies() and the destination implements .putCookie().