{"id":13779341,"url":"https://github.com/koajs/file-server","last_synced_at":"2025-10-08T02:31:46.115Z","repository":{"id":15313760,"uuid":"18043718","full_name":"koajs/file-server","owner":"koajs","description":"file serving middleware for koa","archived":true,"fork":false,"pushed_at":"2016-03-24T12:01:07.000Z","size":36,"stargazers_count":38,"open_issues_count":3,"forks_count":12,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-09-21T18:43:45.456Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/koajs.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":"2014-03-23T21:12:51.000Z","updated_at":"2025-01-11T00:15:01.000Z","dependencies_parsed_at":"2022-08-25T20:20:55.141Z","dependency_job_id":null,"html_url":"https://github.com/koajs/file-server","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/koajs/file-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koajs%2Ffile-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koajs%2Ffile-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koajs%2Ffile-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koajs%2Ffile-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/koajs","download_url":"https://codeload.github.com/koajs/file-server/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koajs%2Ffile-server/sbom","scorecard":{"id":565113,"data":{"date":"2025-08-11","repo":{"name":"github.com/koajs/file-server","commit":"546e56626a862910e6d041dc6bc0b80ec0b2551d"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.9,"checks":[{"name":"Code-Review","score":0,"reason":"Found 1/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"project is archived","details":["Warn: Repository is archived."],"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Security-Policy","score":10,"reason":"security policy file detected","details":["Info: security policy file detected: github.com/koajs/.github/SECURITY.md:1","Info: Found linked content: github.com/koajs/.github/SECURITY.md:1","Info: Found disclosure, vulnerability, and/or timelines in security policy: github.com/koajs/.github/SECURITY.md:1","Info: Found text in security policy: github.com/koajs/.github/SECURITY.md:1"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 1 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-20T14:46:06.556Z","repository_id":15313760,"created_at":"2025-08-20T14:46:06.556Z","updated_at":"2025-08-20T14:46:06.556Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278877636,"owners_count":26061488,"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-10-08T02:00:06.501Z","response_time":56,"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":[],"created_at":"2024-08-03T18:01:04.096Z","updated_at":"2025-10-08T02:31:45.796Z","avatar_url":"https://github.com/koajs.png","language":"JavaScript","readme":"\n# Koa File Server\n\n[![NPM version][npm-image]][npm-url]\n[![build status][travis-image]][travis-url]\n[![Test coverage][coveralls-image]][coveralls-url]\n[![Gittip][gittip-image]][gittip-url]\n\nAn opinionated file server. Designed to sit behind a CDN.\n\n- `sha256` etags and consequential 304s\n- Caches `fs.stat()` calls\n- Caches etag calculations\n- OPTIONS and 405 support\n- `index.html` files\n- Optionally serve hidden files\n- Caches gzipped versions of files\n- SPDY Push support\n\nDoes not support:\n\n- Dynamic files - assumes static files never change.\n  You will have to delete files from the cache yourself if files change.\n- Directory listing\n- Path decoding\n\n## API\n\n```js\nvar app = require('koa')()\napp.use(require('compress')())\napp.use(require('koa-file-server')(options))\n```\n\nOptions are:\n\n- `root` \u003cprocess.cwd()\u003e - root directory. nothing above this root directory can be served\n- `maxage` - cache control max age\n- `etag` - options for etags\n  - `algorithm` \u003csha256\u003e - hashing algorithm to use\n  - `encoding` \u003cbase64\u003e - encoding to use\n- `index` - serve `index.html` files\n- `hidden` \u003cfalse\u003e - show hidden files which leading `.`s\n\n### var file = yield* send(this, [path])\n\n```js\nvar send = require('koa-file-server')(options).send\n```\n\n`serve.send()` allows you to serve files as a utility.\nThis is helpful for arbitrary paths.\nThe middleware also adds `var file = yield* this.fileServer.send(path)`.\n\n`path` defaults to `this.request.path.slice(1)`,\nremoving the leading `/` to make the path relative.\n\nFor an example, see the middleware's source code.\n\n### var file = yield* push(this, path, [options])\n\n```js\nvar push = require('koa-file-server')(options).push\n```\n\nOptionally SPDY Push a file.\nThe middleware also adds `var file = yield* this.fileServer.send(path, [opts])`.\n\nUnlike `send()`, `path` is required.\n`path` must also be a relative path (without a leading `/`) relative to the `root`.\nThe push stream's URL will be `'/' + path`.\nErrors will be thrown on unknown files.\nThe only `option` is `priority: 7`.\n\n[npm-image]: https://img.shields.io/npm/v/koa-file-server.svg?style=flat\n[npm-url]: https://npmjs.org/package/koa-file-server\n[travis-image]: https://img.shields.io/travis/koajs/file-server.svg?style=flat\n[travis-url]: https://travis-ci.org/koajs/file-server\n[coveralls-image]: https://img.shields.io/coveralls/koajs/file-server.svg?style=flat\n[coveralls-url]: https://coveralls.io/r/koajs/file-server?branch=master\n[gittip-image]: https://img.shields.io/gittip/jonathanong.svg?style=flat\n[gittip-url]: https://www.gittip.com/jonathanong/\n","funding_links":[],"categories":["Middleware","仓库"],"sub_categories":["中间件"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoajs%2Ffile-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkoajs%2Ffile-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoajs%2Ffile-server/lists"}