{"id":23060007,"url":"https://github.com/chubbyts/chubbyts-http-static-file","last_synced_at":"2025-04-11T02:41:43.373Z","repository":{"id":148378386,"uuid":"619292747","full_name":"chubbyts/chubbyts-http-static-file","owner":"chubbyts","description":"A minimal static file handler for chubbyts-http-types.","archived":false,"fork":false,"pushed_at":"2025-03-04T13:00:16.000Z","size":59,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-25T00:29:01.264Z","etag":null,"topics":["chubbyts","handler","psr-7","static-file"],"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/chubbyts.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-26T20:14:25.000Z","updated_at":"2025-03-04T13:00:20.000Z","dependencies_parsed_at":"2024-02-27T20:26:31.393Z","dependency_job_id":"0887002f-ea0a-4329-9d41-5778ddc3601b","html_url":"https://github.com/chubbyts/chubbyts-http-static-file","commit_stats":null,"previous_names":["chubbyts/chubbyts-http-static-file","chubbyts/chubbyts-static-file"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chubbyts%2Fchubbyts-http-static-file","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chubbyts%2Fchubbyts-http-static-file/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chubbyts%2Fchubbyts-http-static-file/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chubbyts%2Fchubbyts-http-static-file/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chubbyts","download_url":"https://codeload.github.com/chubbyts/chubbyts-http-static-file/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248331069,"owners_count":21085832,"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":["chubbyts","handler","psr-7","static-file"],"created_at":"2024-12-16T03:11:15.777Z","updated_at":"2025-04-11T02:41:43.351Z","avatar_url":"https://github.com/chubbyts.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# chubbyts-http-static-file\n\n[![CI](https://github.com/chubbyts/chubbyts-http-static-file/workflows/CI/badge.svg?branch=master)](https://github.com/chubbyts/chubbyts-http-static-file/actions?query=workflow%3ACI)\n[![Coverage Status](https://coveralls.io/repos/github/chubbyts/chubbyts-http-static-file/badge.svg?branch=master)](https://coveralls.io/github/chubbyts/chubbyts-http-static-file?branch=master)\n[![Mutation testing badge](https://img.shields.io/endpoint?style=flat\u0026url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fchubbyts%2Fchubbyts-http-static-file%2Fmaster)](https://dashboard.stryker-mutator.io/reports/github.com/chubbyts/chubbyts-http-static-file/master)\n[![npm-version](https://img.shields.io/npm/v/@chubbyts/chubbyts-http-static-file.svg)](https://www.npmjs.com/package/@chubbyts/chubbyts-http-static-file)\n\n[![bugs](https://sonarcloud.io/api/project_badges/measure?project=chubbyts_chubbyts-http-static-file\u0026metric=bugs)](https://sonarcloud.io/dashboard?id=chubbyts_chubbyts-http-static-file)\n[![code_smells](https://sonarcloud.io/api/project_badges/measure?project=chubbyts_chubbyts-http-static-file\u0026metric=code_smells)](https://sonarcloud.io/dashboard?id=chubbyts_chubbyts-http-static-file)\n[![coverage](https://sonarcloud.io/api/project_badges/measure?project=chubbyts_chubbyts-http-static-file\u0026metric=coverage)](https://sonarcloud.io/dashboard?id=chubbyts_chubbyts-http-static-file)\n[![duplicated_lines_density](https://sonarcloud.io/api/project_badges/measure?project=chubbyts_chubbyts-http-static-file\u0026metric=duplicated_lines_density)](https://sonarcloud.io/dashboard?id=chubbyts_chubbyts-http-static-file)\n[![ncloc](https://sonarcloud.io/api/project_badges/measure?project=chubbyts_chubbyts-http-static-file\u0026metric=ncloc)](https://sonarcloud.io/dashboard?id=chubbyts_chubbyts-http-static-file)\n[![sqale_rating](https://sonarcloud.io/api/project_badges/measure?project=chubbyts_chubbyts-http-static-file\u0026metric=sqale_rating)](https://sonarcloud.io/dashboard?id=chubbyts_chubbyts-http-static-file)\n[![alert_status](https://sonarcloud.io/api/project_badges/measure?project=chubbyts_chubbyts-http-static-file\u0026metric=alert_status)](https://sonarcloud.io/dashboard?id=chubbyts_chubbyts-http-static-file)\n[![reliability_rating](https://sonarcloud.io/api/project_badges/measure?project=chubbyts_chubbyts-http-static-file\u0026metric=reliability_rating)](https://sonarcloud.io/dashboard?id=chubbyts_chubbyts-http-static-file)\n[![security_rating](https://sonarcloud.io/api/project_badges/measure?project=chubbyts_chubbyts-http-static-file\u0026metric=security_rating)](https://sonarcloud.io/dashboard?id=chubbyts_chubbyts-http-static-file)\n[![sqale_index](https://sonarcloud.io/api/project_badges/measure?project=chubbyts_chubbyts-http-static-file\u0026metric=sqale_index)](https://sonarcloud.io/dashboard?id=chubbyts_chubbyts-http-static-file)\n[![vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=chubbyts_chubbyts-http-static-file\u0026metric=vulnerabilities)](https://sonarcloud.io/dashboard?id=chubbyts_chubbyts-http-static-file)\n\n## Description\n\nA minimal static file handler for chubbyts-http-types.\n\n## Requirements\n\n * node: 18\n * [@chubbyts/chubbyts-http-error][2]: ^2.4.1\n * [@chubbyts/chubbyts-http-types][3]: ^1.3.1 || ^2.0.0\n\n## Installation\n\nThrough [NPM](https://www.npmjs.com) as [@chubbyts/chubbyts-http-static-file][1].\n\n```ts\nnpm i @chubbyts/chubbyts-http-static-file@^2.2.0\n```\n\n## Usage\n\n```ts\nimport { createStaticFileHandler } from '@chubbyts/chubbyts-http-static-file/dist/handler';\nimport type { ResponseFactory, StreamFromFileFactory } from '@chubbyts/chubbyts-http-types/dist/message-factory';\nimport { createGetRoute } from '@chubbyts/chubbyts-framework/dist/router/route';\n\nconst responseFactory: ResponseFactory = ...;\nconst streamFromFileFactory: StreamFromFileFactory = ...;\n\nconst handler = createStaticFileHandler(\n  responseFactory,\n  streamFromFileFactory,\n  '/path/to/public/directory',\n  (await import('../src/mimetypes')).default, // typescript / ecmascript module\n  // require('../src/mimetypes').default, // commonjs (cjs)\n);\n\n// for example as a fallback route matching everything\nconst route = createGetRoute({\n  path: '/(.*)',\n  name: 'static_file',\n  handler,\n});\n```\n\n## Copyright\n\n2025 Dominik Zogg\n\n[1]: https://www.npmjs.com/package/@chubbyts/chubbyts-http-static-file\n[2]: https://www.npmjs.com/package/@chubbyts/chubbyts-http-error\n[3]: https://www.npmjs.com/package/@chubbyts/chubbyts-http-types\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchubbyts%2Fchubbyts-http-static-file","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchubbyts%2Fchubbyts-http-static-file","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchubbyts%2Fchubbyts-http-static-file/lists"}