{"id":17321804,"url":"https://github.com/avoidwork/tiny-etag","last_synced_at":"2025-06-28T15:31:52.886Z","repository":{"id":55485781,"uuid":"62519976","full_name":"avoidwork/tiny-etag","owner":"avoidwork","description":"ETag middleware","archived":false,"fork":false,"pushed_at":"2025-06-18T10:26:13.000Z","size":912,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-18T11:29:44.845Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://avoidwork.github.io/tiny-etag/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/avoidwork.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","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,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["avoidwork"]}},"created_at":"2016-07-03T23:58:49.000Z","updated_at":"2025-06-18T10:26:10.000Z","dependencies_parsed_at":"2023-11-24T11:29:31.919Z","dependency_job_id":"7f64f270-613a-4759-8c98-8ea2cae97e23","html_url":"https://github.com/avoidwork/tiny-etag","commit_stats":{"total_commits":116,"total_committers":2,"mean_commits":58.0,"dds":"0.017241379310344862","last_synced_commit":"41342be234d04d347a74274b8fba758a9d75cb81"},"previous_names":[],"tags_count":94,"template":false,"template_full_name":null,"purl":"pkg:github/avoidwork/tiny-etag","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avoidwork%2Ftiny-etag","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avoidwork%2Ftiny-etag/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avoidwork%2Ftiny-etag/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avoidwork%2Ftiny-etag/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/avoidwork","download_url":"https://codeload.github.com/avoidwork/tiny-etag/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avoidwork%2Ftiny-etag/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260548228,"owners_count":23026251,"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":[],"created_at":"2024-10-15T13:39:42.010Z","updated_at":"2025-06-28T15:31:52.867Z","avatar_url":"https://github.com/avoidwork.png","language":"JavaScript","funding_links":["https://github.com/sponsors/avoidwork"],"categories":[],"sub_categories":[],"readme":"# tiny-etag\n\nETag middleware for express.js API compatible routers.\n\n## Using the factory\n\n```javascript\nimport {etag} from \"tiny-etag\";\nconst etags = etag({cacheSize: 500});\nconst router = SomeRouter(); /* express.js compatible router */\n\nrouter.use(etags.middleware);\n\nrouter.get(\"/\", (req, res) =\u003e {\n    const body = \"Hello World!\";\n\n    res.writeHead(200, {\"content-type\": \"text/plain\", \"etag\": etags.create(body)});\n    res.end(body);\n});\n```\n\n## Testing\n\nTiny ETag has 100% code coverage with its tests.\n\n```console\n---------------|---------|----------|---------|---------|---------------------\nFile           | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s\n---------------|---------|----------|---------|---------|---------------------\nAll files      |     100 |    78.57 |     100 |     100 |                    \n tiny-etag.cjs |     100 |    78.57 |     100 |     100 | 45-49,59,91-109,115\n---------------|---------|----------|---------|---------|---------------------\n```\n\n## API\n\n### etag({cacheSize: 1000, cacheTTL: 0, seed: random, mimetype: \"text/plain\"})\nReturns an tiny-etag instance. Cache TTL concerns do not spread with a notification.\n\n### create(arg = \"\"[, mimetype = \"text/plain\"])\nCreates a strong ETag value from `arg`; a composite `String` is recommended. It's ideal to \n\n### hash(arg = \"\"[, mimetype=\"text/plain\"])\nCreates a hash of `arg`, uses `create()`\n\n### keep(arg)\nReturns a boolean if `arg` should be kept on the cached `Object`\n\n### middleware(req, res, next)\nMiddleware to be used by an http framework\n\n### parse(arg)\nParses `arg` as a `URL` if it's a `String`, or constructs one if it is a `socket`\n\n### register(url, state)\nAdds `url` to the `cache`\n\n### valid(headers)\nReturns a `Boolean` indicating if caching is valid based on `cache-control`\n\n## License\nCopyright (c) 2023 Jason Mulligan\nLicensed under the BSD-3 license\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Favoidwork%2Ftiny-etag","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Favoidwork%2Ftiny-etag","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Favoidwork%2Ftiny-etag/lists"}