tough-cookie.cookiejar.clone_2.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(newStore?: Store): Promise<CookieJar>;

Parameters

Parameter

Type

Description

newStore

Store

(Optional) The target Store to clone cookies into.

Returns:

Promise<CookieJar>

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().