Basic cookie string/file parse utilities.
Cookie-Parse utilities can be used in both browsers and Node.js:
Install Cookie-Parse by using npm:
npm i @iamsquare/cookie-parse
Since this library is compiled from Typescript, type definition files are provided by default. No additional @types installation required!
You can check the documentation here
Just clone this repo and build the library:
git clone --depth=0 https://github.com/iamsquare/cookie-parse
cd cookie-parse/
npm i
npm run prod
npm run prod
will run Jest and build the library only if it passes all tests. To build without testing:
npm run build
ParsedCookie
serialization.The code in this project is licensed under MIT License.
Reduces a file like:
# Netscape HTTP Cookie File
# https://curl.haxx.se/rfc/cookie_spec.html
# This is a generated file! Do not edit.
.test.dev TRUE / FALSE 1629107116 key1 value1
.test.dev TRUE / FALSE 1629107116 key2 value2
.test.dev TRUE / FALSE 1629107116 key3 value3
to a ParsedCookie
array
Reduces a string like:
.test.dev TRUE / FALSE 1629107116 key1 value1
to a ParsedCookie
Serializes a single or a ParsedCookie
array to a separated key=value sequence like:
'a=b; c=d; e=f;'
Deserializes a semicolon separated key=value sequence like:
to a
ParsedCookie
array