Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/ethanent/lightcookie
- Owner: ethanent
- License: other
- Created: 2017-08-23T23:31:13.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-06-14T18:47:47.000Z (over 3 years ago)
- Last Synced: 2024-02-20T04:19:57.481Z (11 months ago)
- Topics: cookie, cookie-parser, cookie-serializer, javascript, lightweight, node, nodejs
- Language: JavaScript
- Homepage:
- Size: 4.93 MB
- Stars: 22
- Watchers: 1
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
---
> 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!