Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ethanent/lightcookie

Node cookie parsing and serialization
https://github.com/ethanent/lightcookie

cookie cookie-parser cookie-serializer javascript lightweight node nodejs

Last synced: 2 months ago
JSON representation

Node cookie parsing and serialization

Awesome Lists containing this project

README

        

lightcookie logo

---

> Super lightweight cookie parser and serializer

[Full documentation](https://ethanent.github.io/lightcookie/) | [GitHub](https://github.com/ethanent/lightcookie) | [NPM](https://www.npmjs.com/package/lightcookie)

## Installation

```shell
npm i --save lightcookie
```

## Parsing cookie strings

```javascript
const lightcookie = require('lightcookie')

lightcookie.parse('foo=bar; copyright=%C2%A9;another=test') // {foo: 'bar', copyright: '©', another: 'test'}
```

## Serializing objects to cookie strings

```javascript
lightcookie.serialize({
name: 'Ethan',
'HttpOnly': null
}) // 'name=Ethan;HttpOnly'
```

## Why lightcookie?

lightcookie is super lightweight. It's over much more lightweight than cookie, another popular cookie package. lightcookie is the way to go for efficiency as it parses using JS regular expressions!

## Documentation

Have a look at [the full documentation](https://ethanent.github.io/lightcookie/) for details about using the library!