Built and signed on GitHub ActionsBuilt and signed on GitHub Actions
Built and signed on GitHub Actions
latest
harmless-tech/ht-cookieA very simple cookie library
This package works with Node.js, Deno, BrowsersIt is unknown whether this package works with Cloudflare Workers, Bun




JSR Score
100%
Published
7 months ago (0.3.0)
HT Cookie
A very simple cookie and local storage library with no dependencies.
Add to project
Using pnpm:
pnpm add jsr:@harmless/ht-cookie
pnpm add ht-cookie
Using deno:
deno add jsr:@harmless/ht-cookie
deno add ht-cookie
Using npm:
npx jsr add @harmless/ht-cookie
npm add ht-cookie
Using yarn:
yarn add jsr:@harmless/ht-cookie
yarn add ht-cookie
How to use
Cookies
import { Cookie } from "ht-cookie"; function syncExample() { Cookie.set(name: string, data: string, options?: CookieOptions): void; Cookie.get(name: string): string | null; Cookie.remove(name: string): void; } async function asyncExample() { await Cookie.aSet(name: string, data: string, options?: CookieOptions) : Promise<void>; await Cookie.aGet(name: string): Promise<string | null>; await Cookie.aRemove(name: string): Promise<void>; }
interface CookieOptions { maxAge?: number, expires?: Date, domain?: string, path?: string, sameSite?: "strict" | "lax" | "none", secure?: boolean, partitioned?: boolean, }
Local Storage
import { LocalStorage } from "ht-cookie"; function syncExample() { LocalStorage.set(name: string, data: string, maxAge?: number): void; LocalStorage.get(name: string): string | null; LocalStorage.remove(name: string): void; } async function asyncExample() { await LocalStorage.aSet(name: string, data: string, maxAge?: number) : Promise<void>; await LocalStorage.aGet(name: string): Promise<string | null>; await LocalStorage.aRemove(name: string): Promise<void>; }
Built and signed on
GitHub Actions
Add Package
deno add jsr:@harmless/ht-cookie
Import symbol
import * as ht_cookie from "@harmless/ht-cookie";
Import directly with a jsr specifier
import * as ht_cookie from "jsr:@harmless/ht-cookie";
Add Package
pnpm i jsr:@harmless/ht-cookie
pnpm dlx jsr add @harmless/ht-cookie
Import symbol
import * as ht_cookie from "@harmless/ht-cookie";
Add Package
yarn add jsr:@harmless/ht-cookie
yarn dlx jsr add @harmless/ht-cookie
Import symbol
import * as ht_cookie from "@harmless/ht-cookie";
Add Package
vlt install jsr:@harmless/ht-cookie
Import symbol
import * as ht_cookie from "@harmless/ht-cookie";
Add Package
npx jsr add @harmless/ht-cookie
Import symbol
import * as ht_cookie from "@harmless/ht-cookie";
Add Package
bunx jsr add @harmless/ht-cookie
Import symbol
import * as ht_cookie from "@harmless/ht-cookie";