# native-cookies

> Cookie manager for React Native

Latest version **3.1.1** (published 2022-11-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install native-cookies
pnpm add native-cookies
yarn add native-cookies
bun add native-cookies
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.1.1 |
| Published | 2022-11-08 |
| First published | 2020-06-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 35.7 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Yogendra Shelke |
| Maintainers | yogendra_sh |
| Keywords | react-native, ios, android |

## Links

- npm: https://www.npmjs.com/package/native-cookies
- Repository: https://github.com/YogendraShelke/native-cookies
- Homepage: https://github.com/YogendraShelke/native-cookies#readme
- Issues: https://github.com/YogendraShelke/native-cookies/issues
- npm.io page: https://npm.io/package/native-cookies

## Dependencies (1)

- [cookie](https://npm.io/package/cookie.md) ^0.3.1

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 3.1.1 (latest) — 2022-11-08
- 3.1.0 — 2020-06-16
- 3.0.0 — 2020-06-16
- 2.1.0 — 2020-06-16
- 2.0.1 — 2020-06-15
- 2.0.0 — 2020-06-15
- 1.0.0 — 2020-06-15
- 0.1.0 — 2020-06-15

## README

## native-cookies

Cookie manager for React Native

## Installation

```sh

npm install native-cookies

# for iOS only
npx pod-install ios

```
## Usage

### Import  

```javascript

import  Cookies  from  "native-cookies";

```

### Get
```javascript

// get all cookies which are belonged to 'http://github.com/'
Cookies.get("http://github.com/").then((cookie) =>  console.log(cookie));


// get cookie named 'foo' from 'http://github.com/'
Cookies.get("http://github.com/", "foo").then((cookie) =>  console.log(cookie));

```

### Set

```javascript

// set cookie 'foo=bar' for 'http://github.com/'
Cookies.set("http://github.com/", "foo", "bar").then(() =>
	console.log("success")
);


// set cookie 'foo=bar' for 'http://github.com/' with options:
Cookies.set("http://github.com/", "foo", "bar", {
	path:  "enterprise",
	domain:  "github.com",
}).then(() =>  console.log("success"));

```

**Options**
 - domain

> Specifies the value for the Domain Set-Cookie attribute. By default,
> no domain is set, and most clients will consider the cookie to apply
> to only the current domain.

 - expires

> Specifies the Date object to be the value for the Expires Set-Cookie
> attribute. By default, no expiration is set, and most clients will
> consider this a "non-persistent cookie" and will delete it on a
> condition like exiting a web browser application.

 - path
> Specifies the value for the Path Set-Cookie attribute. By default, the
> path is considered the "default path". By default, no maximum age is
> set, and most clients will consider this a "non-persistent cookie" and
> will delete it on a condition like exiting a web browser application

### Clear

```javascript

// clear all cookies for 'http://github.com'
Cookies.clear("http://github.com");

```

### ClearAll
```javascript

// clear all cookies for all domains
Cookies.clearAll();

```
## License
MIT

---
_Source: https://npm.io/package/native-cookies · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
