333
schangxiang@126.com
2025-09-19 18966e02fb573c7e2bb0c6426ed792b38b910940
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
type s = number;
 
declare namespace Cookies {
    interface Cookie {
        name: string;
        value?: string;
        expires?: Date;
        path?: string;
        domain?: string;
        secure?: boolean;
        httponly?: boolean;
    }
 
    interface Options {
        sessionTimeout?: s;
    }
}
 
/** Creates a biskviit cookie jar for managing cookie values in memory */
declare class Cookies {
    options: Cookies.Options;
    cookies: Cookies.Cookie[];
 
    constructor(options?: Cookies.Options);
 
    /** Stores a cookie string to the cookie storage */
    set(cookieStr: string, url: string): boolean;
 
    /** Returns cookie string for the 'Cookie:' header. */
    get(url: string): string;
 
    /** Lists all valied cookie objects for the specified URL */
    list(url: string): Cookies.Cookie[];
 
    /** Parses cookie string from the 'Set-Cookie:' header */
    parse(cookieStr: string): Cookies.Cookie;
 
    /** Checks if a cookie object is valid for a specified URL */
    match(cookie: Cookies.Cookie, url: string): boolean;
 
    /** Adds (or updates/removes if needed) a cookie object to the cookie storage */
    add(cookie: Cookies.Cookie): boolean;
 
    /** Checks if two cookie objects are the same */
    compare(a: Cookies.Cookie, b: Cookies.Cookie): boolean;
 
    /** Checks if a cookie is expired */
    isExpired(cookie: Cookies.Cookie): boolean;
 
    /** Returns normalized cookie path for an URL path argument */
    getPath(pathname: string): string;
}
 
export = Cookies;