npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

expo-cookies

v1.0.2

Published

Cookie Manager for Expo using Expo Modules API

Readme

expo-cookies

🍪 Cookie Manager for Expo using Expo Modules API

A modern cookie management library for Expo applications, built with the Expo Modules API. This library provides a clean, promise-based interface for managing HTTP cookies across iOS and Android platforms.

Features

  • iOS Support - Full cookie management with WebKit support
  • Android Support - Complete cookie functionality
  • TypeScript - Full TypeScript support with type definitions
  • Expo Modules API - Built with modern Expo Modules API
  • Promise-based - Clean async/await API
  • WebKit Support - iOS WebKit cookie store integration
  • Cross-platform - Works on both iOS and Android

Installation

npm install expo-cookies
# or
yarn add expo-cookies

Version Requirements

  • Expo SDK: 52+
  • React Native: 0.79+
  • iOS: 15.1+
  • Android: API 21+

Configure for development builds

If you're using development builds, you'll need to rebuild your development client after installing this library.

Usage

Basic Usage

import CookieManager from 'expo-cookies';

// Set a cookie
await CookieManager.set('https://example.com', {
  name: 'userToken',
  value: 'abc123',
  domain: 'example.com',
  path: '/',
  expires: '2025-12-31T23:59:59.000Z',
  secure: true,
  httpOnly: false
});

// Get cookies for a URL
const cookies = await CookieManager.get('https://example.com');
console.log(cookies);

// Clear all cookies
await CookieManager.clearAll();

Set cookies from response header

// Set cookies from a response header
await CookieManager.setFromResponse(
  'https://example.com',
  'sessionId=def456; Path=/; Secure; HttpOnly'
);

iOS WebKit Support

const useWebKit = true;

// Set cookie in WebKit store
await CookieManager.set('https://example.com', {
  name: 'webkitCookie',
  value: 'webkit123',
  domain: 'example.com',
  path: '/'
}, useWebKit);

// Get cookies from WebKit store
const webkitCookies = await CookieManager.get('https://example.com', useWebKit);

Android-specific methods

// Flush cookies to persistent storage (Android only)
await CookieManager.flush();

// Remove session cookies (Android only)
const removed = await CookieManager.removeSessionCookies();

iOS-specific methods

// Get all cookies (iOS only)
const allCookies = await CookieManager.getAll();

// Clear specific cookie by name (iOS only)
await CookieManager.clearByName('https://example.com', 'cookieName');

API Reference

Cookie Object

interface Cookie {
  name: string;
  value: string;
  path?: string;
  domain?: string;
  version?: string;
  expires?: string; // ISO 8601 format
  secure?: boolean;
  httpOnly?: boolean;
}

Methods

set(url: string, cookie: Cookie, useWebKit?: boolean): Promise<boolean>

Set a cookie for the given URL.

setFromResponse(url: string, cookieHeader: string): Promise<boolean>

Set cookies from a response header string.

get(url: string, useWebKit?: boolean): Promise<Cookies>

Get cookies for a specific URL.

getAll(useWebKit?: boolean): Promise<Cookies> (iOS only)

Get all cookies.

clearAll(useWebKit?: boolean): Promise<boolean>

Clear all cookies.

clearByName(url: string, name: string, useWebKit?: boolean): Promise<boolean> (iOS only)

Clear a specific cookie by name.

flush(): Promise<boolean> (Android only)

Flush cookies to persistent storage.

removeSessionCookies(): Promise<boolean> (Android only)

Remove session cookies.

Platform Support

| Platform | Support | |----------|---------| | iOS | ✅ Full support with WebKit | | Android | ✅ Full support | | Web | ❌ Not supported |

WebKit Support (iOS)

On iOS, cookies can be stored in two different stores:

  1. NSHTTPCookieStorage (default) - Shared with other HTTP requests
  2. WKHTTPCookieStore - Used by WebKit WebViews

You can specify which store to use by passing the useWebKit parameter to the relevant methods.

Development

Project Structure

expo-cookies/
├── src/
│   ├── index.ts                 # Main TypeScript interface
│   └── ExpoCookies.types.ts     # TypeScript types
├── ios/
│   └── ExpoCookiesModule.swift  # iOS implementation
├── android/
│   └── src/main/java/expo/modules/cookies/
│       └── ExpoCookiesModule.kt # Android implementation
├── expo-module.config.json      # Expo module configuration
└── package.json

Building

npm run build

Testing

npm run test

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT License - see LICENSE file for details.

Acknowledgments

This module was inspired by @react-native-cookies/cookies and adapted to use the Expo Modules API for better integration with Expo applications.