{"id":13487437,"url":"https://github.com/eggjs/static","last_synced_at":"2025-03-27T21:32:31.565Z","repository":{"id":57220749,"uuid":"63400367","full_name":"eggjs/static","owner":"eggjs","description":"static server plugin for egg","archived":false,"fork":false,"pushed_at":"2025-01-12T15:25:29.000Z","size":47,"stargazers_count":91,"open_issues_count":1,"forks_count":16,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-01-12T15:41:49.545Z","etag":null,"topics":["egg","egg-plugin","egg-static"],"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,"publiccode":null,"codemeta":null}},"created_at":"2016-07-15T07:15:28.000Z","updated_at":"2025-01-12T15:26:32.000Z","dependencies_parsed_at":"2022-08-29T04:01:29.756Z","dependency_job_id":"3f7a38e4-3529-4053-a5fd-fe04dc6c5015","html_url":"https://github.com/eggjs/static","commit_stats":{"total_commits":37,"total_committers":11,"mean_commits":"3.3636363636363638","dds":0.7027027027027026,"last_synced_commit":"b8a2a0f08c288dd092f91338d16c4583ab37f2c6"},"previous_names":["eggjs/static"],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fstatic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fstatic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fstatic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fstatic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eggjs","download_url":"https://codeload.github.com/eggjs/static/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245508045,"owners_count":20626720,"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":["egg","egg-plugin","egg-static"],"created_at":"2024-07-31T18:00:59.295Z","updated_at":"2025-03-27T21:32:31.521Z","avatar_url":"https://github.com/eggjs.png","language":"TypeScript","readme":"# @eggjs/static\n\n[![NPM version][npm-image]][npm-url]\n[![Node.js CI](https://github.com/eggjs/static/actions/workflows/nodejs.yml/badge.svg)](https://github.com/eggjs/static/actions/workflows/nodejs.yml)\n[![Test coverage][codecov-image]][codecov-url]\n[![Known Vulnerabilities][snyk-image]][snyk-url]\n[![npm download][download-image]][download-url]\n[![Node.js Version](https://img.shields.io/node/v/@eggjs/static.svg?style=flat)](https://nodejs.org/en/download/)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://makeapullrequest.com)\n\n[npm-image]: https://img.shields.io/npm/v/@eggjs/static.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/@eggjs/static\n[codecov-image]: https://img.shields.io/codecov/c/github/eggjs/static.svg?style=flat-square\n[codecov-url]: https://codecov.io/github/eggjs/static?branch=master\n[snyk-image]: https://snyk.io/test/npm/@eggjs/static/badge.svg?style=flat-square\n[snyk-url]: https://snyk.io/test/npm/@eggjs/static\n[download-image]: https://img.shields.io/npm/dm/@eggjs/static.svg?style=flat-square\n[download-url]: https://npmjs.org/package/@eggjs/static\n\nStatic server plugin for egg, base on [@eggjs/koa-static-cache](https://github.com/eggjs/koa-static-cache).\n\n## Install\n\n`@eggjs/static` is a plugin that has been built-in for egg. It is enabled by default.\n\n## Configuration\n\n`@eggjs/static` support all configurations in [@eggjs/koa-static-cache](https://github.com/eggjs/koa-static-cache).\nAnd with default configurations below:\n\n- prefix: `'/public/'`\n- dir: `path.join(appInfo.baseDir, 'app/public')`\n- dynamic: `true`\n- preload: `false`\n- maxAge: `31536000` in prod env, `0` in other envs\n- buffer: `true` in prod env, `false` in other envs\n\n`@eggjs/static` provides one more option:\n\n- maxFiles: the maximum value of cache items, only effective when dynamic is true, default is `1000`.\n\n**All static files in `$baseDir/app/public` can be visited with prefix `/public`, and all the files are lazy loaded.**\n\n- In non-production environment, assets won't be cached, your modification can take effect immediately.\n- In production environment, `@eggjs/static` will cache the assets after visited, you need to restart the process to update the assets.\n- Dir default is `$baseDir/app/public` but you can also define **multiple directory** by use `dir: [dir1, dir2, ...]` or `dir: [dir1, { prefix: '/static2', dir: dir2 }]`, static server will use all these directories.\n\n```ts\n// {app_root}/config/config.default.ts\nexport default {\n  static: {\n    // maxAge: 31536000,\n  },\n};\n```\n\n## Questions \u0026 Suggestions\n\nPlease open an issue [here](https://github.com/eggjs/egg/issues).\n\n## License\n\n[MIT](LICENSE)\n\n## Contributors\n\n[![Contributors](https://contrib.rocks/image?repo=eggjs/static)](https://github.com/eggjs/static/graphs/contributors)\n\nMade with [contributors-img](https://contrib.rocks).\n","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)"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feggjs%2Fstatic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feggjs%2Fstatic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feggjs%2Fstatic/lists"}