{"id":22328692,"url":"https://github.com/seangenabe/etagger","last_synced_at":"2025-07-29T18:31:33.861Z","repository":{"id":10120999,"uuid":"64549183","full_name":"seangenabe/etagger","owner":"seangenabe","description":"hapi ETag helper plugin","archived":false,"fork":false,"pushed_at":"2023-01-04T21:36:54.000Z","size":1103,"stargazers_count":2,"open_issues_count":6,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-21T19:31:43.951Z","etag":null,"topics":["etag","hapi","hapi-plugin"],"latest_commit_sha":null,"homepage":null,"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/seangenabe.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-07-30T14:55:35.000Z","updated_at":"2021-06-10T11:45:56.000Z","dependencies_parsed_at":"2023-01-11T17:46:51.438Z","dependency_job_id":null,"html_url":"https://github.com/seangenabe/etagger","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seangenabe%2Fetagger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seangenabe%2Fetagger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seangenabe%2Fetagger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seangenabe%2Fetagger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/seangenabe","download_url":"https://codeload.github.com/seangenabe/etagger/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228034838,"owners_count":17859246,"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":["etag","hapi","hapi-plugin"],"created_at":"2024-12-04T03:13:15.818Z","updated_at":"2024-12-04T03:13:16.389Z","avatar_url":"https://github.com/seangenabe.png","language":"TypeScript","readme":"# etagger\n\nhapi Etag helper plugin\n\n[![npm](https://img.shields.io/npm/v/etagger.svg?style=flat-square)](https://www.npmjs.com/package/etagger)\n[![Build Status](https://img.shields.io/travis/seangenabe/etagger/master.svg?style=flat-square)](https://travis-ci.org/seangenabe/etagger)\n[![Coverage Status](https://img.shields.io/coveralls/seangenabe/etagger/master.svg?style=flat-square)](https://coveralls.io/github/seangenabe/etagger?branch=master)\n[![Dependency Status](https://img.shields.io/david/seangenabe/etagger.svg?style=flat-square)](https://david-dm.org/seangenabe/etagger)\n[![devDependency Status](https://img.shields.io/david/dev/seangenabe/etagger.svg?style=flat-square)](https://david-dm.org/seangenabe/etagger#info=devDependencies)\n[![node](https://img.shields.io/node/v/etagger.svg?style=flat-square)](https://nodejs.org/en/download/)\n\n## Versions\n\n* `3.x` - last version compatible with hapi 16\n* `\u003e=4` - latest hapi\n\n## Usage\n\n```javascript\nawait server.register(\n  {\n    plugin: require('etagger'),\n    options: pluginOptions\n  },\n  options\n)\n```\n\n### Options\n\n* `enabled: Boolean` - Enable processing for the connection/the current route. (Default: `undefined`  - **not enabled by default**.)\n* `nonSuccess: Boolean` - Enable processing for non-success (_not_ 2xx) status codes. (Default: `undefined`)\n\nFor string and buffer response sources, the ETag will simply be attached.\n\nStream and error response sources are ignored.\n\nThese options can either be set in the plugin options (see above) or per-route:\n\n```javascript\n{\n  \"config\": {\n    \"plugins\": {\n      \"etagger\": {\n        /* ... */\n      }\n    }\n  }\n}\n```\n\nWhen set in the route, these options will override the plugin options.\n\n### server.plugins.etagger.etag(response, opts)\n\nManually attach an ETag to a response. This is useful i.e. to etag manually in your own extension handlers.\n\n* `response` - The response object.\n* `opts` - Same as the options.\n  * `enabled` - Ignored. This function will always attach an ETag to the response.\n\n### No stream support\n\nIf you want to attach an ETag to a resource, just give up on streaming it. ETag is based on the value of the _whole_ resource, so there's no point to attaching an ETag to it if we might not have all of it.\n\nAlternatively, precalculate the ETag that you want to attach to a resource. That way you can just call `response.etag()` when you stream it. 👍\n\nYou can also try buffering the whole resource, in which case, you can just submit the resulting buffer to `reply` and be able to use this plugin.\n\nStreaming _is_ awesome, but there are situations where it is right or it is wrong to use with.\n\n## License\n\nMIT\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseangenabe%2Fetagger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fseangenabe%2Fetagger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseangenabe%2Fetagger/lists"}