{"id":13487469,"url":"https://github.com/eggjs/egg-cookies","last_synced_at":"2025-03-27T22:31:02.358Z","repository":{"id":9801042,"uuid":"63386669","full_name":"eggjs/egg-cookies","owner":"eggjs","description":"cookies module for egg, base on pillarjs/cookies","archived":false,"fork":false,"pushed_at":"2024-07-06T09:23:55.000Z","size":154,"stargazers_count":29,"open_issues_count":0,"forks_count":17,"subscribers_count":27,"default_branch":"master","last_synced_at":"2024-10-29T21:05:51.800Z","etag":null,"topics":["cookie","egg-plugin"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/eggjs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2016-07-15T02:54:52.000Z","updated_at":"2024-07-06T09:26:46.000Z","dependencies_parsed_at":"2023-01-13T15:34:35.196Z","dependency_job_id":"35e206dc-f7f4-4e66-80c0-9503c0d3b838","html_url":"https://github.com/eggjs/egg-cookies","commit_stats":{"total_commits":81,"total_committers":20,"mean_commits":4.05,"dds":0.7037037037037037,"last_synced_commit":"2d22d6d5eed5fd0e75602da8fb0507474a9862ea"},"previous_names":[],"tags_count":36,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fegg-cookies","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fegg-cookies/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fegg-cookies/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fegg-cookies/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eggjs","download_url":"https://codeload.github.com/eggjs/egg-cookies/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222133478,"owners_count":16936776,"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","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","egg-plugin"],"created_at":"2024-07-31T18:00:59.760Z","updated_at":"2024-10-30T22:31:03.368Z","avatar_url":"https://github.com/eggjs.png","language":"TypeScript","funding_links":[],"categories":["仓库"],"sub_categories":["[内置插件](https://eggjs.org/zh-cn/basics/plugin.html#%E6%8F%92%E4%BB%B6%E5%88%97%E8%A1%A8)"],"readme":"# @eggjs/cookies\n\n[![NPM version][npm-image]][npm-url]\n[![build status][ci-image]][ci-url]\n[![Test coverage][codecov-image]][codecov-url]\n[![npm download][download-image]][download-url]\n\n[npm-image]: https://img.shields.io/npm/v/@eggjs/cookies.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/@eggjs/cookies\n[ci-image]: https://github.com/eggjs/egg-cookies/actions/workflows/nodejs.yml/badge.svg\n[ci-url]: https://github.com/eggjs/egg-cookies/actions/workflows/nodejs.yml\n[codecov-image]: https://codecov.io/gh/eggjs/egg-cookies/branch/master/graph/badge.svg\n[codecov-url]: https://codecov.io/gh/eggjs/egg-cookies\n[download-image]: https://img.shields.io/npm/dm/@eggjs/cookies.svg?style=flat-square\n[download-url]: https://npmjs.org/package/@eggjs/cookies\n\nExtends [pillarjs/cookies](https://github.com/pillarjs/cookies) to adapt koa and egg with some additional features.\n\n## Encrypt\n\n`@eggjs/cookies` provide an alternative `encrypt` mode like `signed`. An encrypt cookie's value will be encrypted base on keys. Anyone who don't have the keys are unable to know the original cookie's value.\n\n```ts\nimport { Cookies } from '@eggjs/cookies';\n\nconst cookies = new Cookies(ctx, keys[, defaultCookieOptions]);\n\ncookies.set('foo', 'bar', { encrypt: true });\ncookies.get('foo', { encrypt: true });\n```\n\n**Note: you should both indicating in get and set in pairs.**\n\n## Cookie Length Check\n\n[Browsers all had some limitation in cookie's length](http://browsercookielimits.squawky.net/), so if set a cookie with an extremely long value(\u003e 4093), `@eggjs/cookies` will emit an `cookieLimitExceed` event. You can listen to this event and record.\n\n```ts\nimport { Cookies } from '@eggjs/cookies';\n\nconst cookies = new Cookies(ctx, keys);\n\ncookies.on('cookieLimitExceed', ({ name, value }) =\u003e {\n  // log\n});\n\ncookies.set('foo', longText);\n```\n\n## License\n\n[MIT](LICENSE)\n\n## Contributors\n\n[![Contributors](https://contrib.rocks/image?repo=eggjs/egg-cookies)](https://github.com/eggjs/egg-cookies/graphs/contributors)\n\nMade with [contributors-img](https://contrib.rocks).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feggjs%2Fegg-cookies","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feggjs%2Fegg-cookies","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feggjs%2Fegg-cookies/lists"}