Brunobkr/llama.cpp_AlgMor24_github
ΩFFFΣLLIa • llama.cpp • AlgMor24 ██████╗ ███████╗███████╗███████╗██╗ ██╗ ██╗ █████╗ ██╔═══██╗██╔════╝██╔════╝██╔════╝██║ ██║ ██║██╔══██╗ ██║ ██║█████╗ █████╗ █████╗ ██║ ██║ ██║███████║ ██║ ██║██╔══╝ ██╔══╝ ██╔══╝ ██║ ██║ ██║██╔══██║ ╚██████╔╝██║ ██║ ███████╗███████╗███████╗██║██║ ██║ ╚═════╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝╚══════╝╚═╝╚═╝ ╚═╝ High-Performance LLM / VLM Inference & Autonomous Agentic Ecosystem… See the full description on the dataset page: https://huggingface.co/datasets/Brunobkr/llama.cpp_AlgMor24_github.
03.1k
1# set-cookie-parser 2 3[](https://github.com/nfriedly/set-cookie-parser/actions/workflows/node.js.yml)4[![NPM version][npm-image]][npm-url] 5[][npm-url]6 7---8 9Parses set-cookie headers into JavaScript objects10 11Accepts a single `set-cookie` header value, an array of `set-cookie` header values, a Node.js response object, or a `fetch()` `Response` object that may have 0 or more `set-cookie` headers.12 13Returns either an array of cookie objects or a map of name => cookie object with options set `{map: true}`. Each cookie object will have, at a minimum `name` and `value` properties, and may have additional properties depending on the set-cookie header:14 15* `name` - cookie name (string)16* `value` - cookie value (string)17* `path` - URL path to limit the scope to (string or undefined)18* `domain` - domain to expand the scope to (string or undefined, may begin with "." to indicate the named domain or any subdomain of it)19* `expires` - absolute expiration date for the cookie (Date object or undefined)20* `maxAge` - relative expiration time of the cookie in seconds from when the client receives it (integer or undefined)21 * Note: when using with [express's res.cookie() method](http://expressjs.com/en/4x/api.html#res.cookie), multiply `maxAge` by 1000 to convert to milliseconds.22* `secure` - indicates cookie should only be sent over HTTPs (true or undefined)23* `httpOnly` - indicates cookie should *not* be accessible to client-side JavaScript (true or undefined)24* `sameSite` - indicates if cookie should be included in cross-site requests ([more info](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value)) (string or undefined)25 * Note: valid values are `"Strict"`, `"Lax"`, and `"None"`, but set-cookie-parser copies the value verbatim and does *not* perform any validation.26* `partitioned` - indicates cookie should be scoped to the combination of 3rd party domain + top page domain ([more info](https://developer.mozilla.org/en-US/docs/Web/Privacy/Privacy_sandbox/Partitioned_cookies)) (true or undefined)27 28(The output format is loosely based on the input format of https://www.npmjs.com/package/cookie)29 30## Install31 32```sh33$ npm install --save set-cookie-parser34```35 36 37## Usage38 39### Get array of cookie objects40 41```js42import * as http from 'node:http';43import { parseSetCookie } from 'set-cookie-parser';44// or const { parseSetCookie } = require('set-cookie-parser');45 46http.get('http://example.com', function(res) {47 const cookies = parseSetCookie(res, {48 decodeValues: true // default: true49 });50 51 cookies.forEach(console.log);52}53```54 55Example output:56 57```js58[59 {60 name: 'bam',61 value: 'baz'62 },63 {64 name: 'foo',65 value: 'bar',66 path: '/',67 expires: new Date('Tue Jul 01 2025 06:01:11 GMT-0400 (EDT)'),68 maxAge: 1000,69 domain: '.example.com',70 secure: true,71 httpOnly: true,72 sameSite: 'lax'73 }74]75```76 77### Get map of cookie objects78 79```js80import * as http from 'node:http';81import { parseSetCookie } from 'set-cookie-parser';82// or const { parseSetCookie } = require('set-cookie-parser');83 84http.get('http://example.com', function(res) {85 const cookies = parseSetCookie(res, {86 decodeValues: true, // default: true87 map: true // default: false88 });89 90 const desiredCookie = cookies['session'];91 console.log(desiredCookie);92});93```94Example output:95```js96{97 bam: {98 name: 'bam',99 value: 'baz'100 },101 foo: {102 name: 'foo',103 value: 'bar',104 path: '/',105 expires: new Date('Tue Jul 01 2025 06:01:11 GMT-0400 (EDT)'),106 maxAge: 1000,107 domain: '.example.com',108 secure: true,109 httpOnly: true,110 sameSite: 'lax'111 }112}113```114 115### Creating a new, modified set-cookie header116 117This library can be used in conjunction with the [cookie](https://www.npmjs.com/package/cookie) library to modify and replace set-cookie headers:118 119```js120import * as libCookie from 'cookie';121import { parseSetCookie } from 'set-cookie-parser';122// or const { parseSetCookie } = require('set-cookie-parser');123 124function modifySetCookie(res){125 // parse the set-cookie headers with this library126 const cookies = parseSetCookie(res);127 128 // modify the cookies here129 // ...130 131 // create new set-cookie headers using the cookie library132 res.headers['set-cookie'] = cookies.map(function(cookie) {133 return libCookie.serialize(cookie.name, cookie.value, cookie);134 });135}136```137 138See a real-world example of this in [unblocker](https://github.com/nfriedly/node-unblocker/blob/08a89ec27274b46dcd80d0a324a59406f2bdad3d/lib/cookies.js#L67-L85)139 140## API141 142### parseSetCookie(input, [options])143 144Parses cookies from a string, array of strings, or a http response object. 145Always returns an array, regardless of input format. (Unless the `map` option is set, in which case it always returns an object.)146 147Also accepts an optional options object. Defaults:148 149```js150{151 decodeValues: true, // Calls decodeURIComponent on each value - default: true152 map: false, // Return an object instead of an array - default: false153 silent: false, // Suppress the warning that is logged when called on a request instead of a response - default: false154 split: 'auto', // Separate combined cookie headers. Valid options are true/false/'auto'. 'auto' splits strings but not arrays.155}156```157 158## References159 160* [RFC 6265: HTTP State Management Mechanism](https://tools.ietf.org/html/rfc6265)161* [draft-ietf-httpbis-rfc6265bis-10](https://httpwg.org/http-extensions/draft-ietf-httpbis-rfc6265bis.html)162 163## License164 165MIT © [Nathan Friedly](http://www.nfriedly.com/)166 167 168[npm-image]: https://badge.fury.io/js/set-cookie-parser.svg169[npm-url]: https://npmjs.org/package/set-cookie-parser170 