{"id":14989598,"url":"https://github.com/srph/cookie-machine","last_synced_at":"2026-02-24T21:33:01.653Z","repository":{"id":75646641,"uuid":"46283154","full_name":"srph/cookie-machine","owner":"srph","description":":cookie: A universal/isomorphic cookie library","archived":false,"fork":false,"pushed_at":"2016-01-07T15:47:48.000Z","size":13,"stargazers_count":5,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-05T17:11:09.941Z","etag":null,"topics":["cookie","express-middleware","koa-middleware","universal-javascript"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/srph.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-16T15:24:47.000Z","updated_at":"2019-10-14T03:48:26.000Z","dependencies_parsed_at":"2023-03-17T07:50:40.747Z","dependency_job_id":null,"html_url":"https://github.com/srph/cookie-machine","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/srph/cookie-machine","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srph%2Fcookie-machine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srph%2Fcookie-machine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srph%2Fcookie-machine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srph%2Fcookie-machine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/srph","download_url":"https://codeload.github.com/srph/cookie-machine/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srph%2Fcookie-machine/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270470124,"owners_count":24589290,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-14T02:00:10.309Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cookie","express-middleware","koa-middleware","universal-javascript"],"created_at":"2024-09-24T14:18:37.869Z","updated_at":"2026-02-24T21:32:56.630Z","avatar_url":"https://github.com/srph.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## cookie-machine [![npm version](http://img.shields.io/npm/v/cookie-machine.svg?style=flat-square)](https://npmjs.org/package/cookie-machine?style=flat-square) [![Build Status](https://img.shields.io/travis/srph/cookie-machine.svg?style=flat-square)](https://travis-ci.org/srph/cookie-machine?branch=master)\nA universal cookie library.\n\n### Installing\n```bash\nnpm i cookie-machine -S\n```\n\nAlthough tests are running on node `\u003e=4.0` (because of jsdom), the library should support node `\u003e=0.12`.\n\nCurrently, only CommonJS is supported. Please submit an issue if you'd like any other module to be supported. Although, browser builds have low chances of being supported because it doesn't make any sense.\n\n### Usage\n```js\n// server-side / node\nvar cookie = require('cookie-machine');\n\nhttp.createServer(function(req, res) {\n  cookie.init(res);\n  cookie.set('yolo', 'swag');\n});\n\n// browser\nvar cookie = require('cookie-machine');\n// notice that we no longer have to call `init` here.\n// init is only required for the server-side.\ncookie.set('yolo', 'swag');\n```\n\nCheck out more [examples](tree/master/examples).\n\n### API\nHere are some of the methods exposed by the library:\n\n#### `init(object res): void`\n- `res` - An object which is expected to be node's native `response`.\n\nInitializes `cookie` to be ready for node. In the client, this is a `noop`.\n\n#### `get(string key): any`\n- `key` - The key of the cookie to be get.\nReturns the value of the key in the cookie.\n\n#### `set(string key, any value [, object options]): void`\n- `key` - The key of the cookie to be stored.\n- `value` - The value of the cookie to be stored.\n- `options` - (`optional`, *defaults* to `{ expires: new Date(0) }`) Cookie options such as `expired`, `domain`, `path`, and etc.\n\nSet a value in the cookie.\n\n#### `remove(string key [, object options]): void`\n- `key` - Key in the cookie to be removed.\n- `options` - (`optional`, *defaults* to `{ expires: new Date(0) }`) Cookie options such as `expired`, `domain`, `path`, and etc.\n\nRemove a key in the cookie.\n\n### License\n[MIT](LICENSE)\n\nThis project was motivated by [cookie-dough](https://github.com/change/cookie).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsrph%2Fcookie-machine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsrph%2Fcookie-machine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsrph%2Fcookie-machine/lists"}