Socket
Socket
Sign inDemoInstall

@alicloud/cookie

Package Overview
Dependencies
Maintainers
5
Versions
123
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@alicloud/cookie

ConsoleBase Cookie


Version published
Weekly downloads
47
decreased by-91.78%
Maintainers
5
Weekly downloads
 
Created
Source

@alicloud/cookie

yet... another 饼干的获取和操作工具

INSTALL

tnpm i @alicloud/cookie -S

API

getAllCookies

获取当前页面可以访问到的全部 cookie。

function getAllCookies(): object;

getCookie

获取单个 cookie

function getCookie(name: string): string | undefined;

setCookie

设置 cookie,设置 cookie,默认为时间为 180 天,设置 extra.days 为 0 可以保存为 session cookie(expires 为空)

function setCookie(name: string, value: string, extra: {
  domain?: string; // 默认为当前页面的二级域名,如 `.aliyun.com`,如果是 IP 则为 IP,如 `127.0.0.1`
  path?: string; // 默认 '/'
  days?: number; // 默认 180,传入 `days: 0` 成为 session cookie
  encoding?: boolean; // 默认 true,传入 `false` 可保存原始的值(比如 value 已经经过 base64 编码过)
} = {}): void;

deleteCookie

删除 cookie,其实设置一个过期时间为此刻之前的时间,浏览器会自动清理过期的 cookie

function deleteCookie(name: string, extra: {
  domain?: string;
  path?: string;
} = {}): void;

Keywords

FAQs

Package last updated on 10 Mar 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc