{"id":15066399,"url":"https://github.com/jaguar-dart/jaguar_static_file","last_synced_at":"2026-01-02T19:14:53.290Z","repository":{"id":56833231,"uuid":"76678134","full_name":"Jaguar-dart/jaguar_static_file","owner":"Jaguar-dart","description":"Static file handler for Jaguar","archived":false,"fork":false,"pushed_at":"2017-10-15T21:44:17.000Z","size":18,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-16T04:27:56.997Z","etag":null,"topics":["dart","interceptor","request-handler","server","server-side","static-file-server","static-files"],"latest_commit_sha":null,"homepage":"https://pub.dartlang.org/packages/jaguar_static_file","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Jaguar-dart.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":"2016-12-16T19:00:30.000Z","updated_at":"2017-10-15T18:40:00.000Z","dependencies_parsed_at":"2022-09-08T07:10:32.104Z","dependency_job_id":null,"html_url":"https://github.com/Jaguar-dart/jaguar_static_file","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jaguar-dart%2Fjaguar_static_file","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jaguar-dart%2Fjaguar_static_file/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jaguar-dart%2Fjaguar_static_file/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jaguar-dart%2Fjaguar_static_file/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Jaguar-dart","download_url":"https://codeload.github.com/Jaguar-dart/jaguar_static_file/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243826826,"owners_count":20354220,"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":["dart","interceptor","request-handler","server","server-side","static-file-server","static-files"],"created_at":"2024-09-25T01:07:14.243Z","updated_at":"2026-01-02T19:14:53.233Z","avatar_url":"https://github.com/Jaguar-dart.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jaguar_static_file\n\nProvides two ways to serve static files\n  1) [`StaticFileHandler`](StaticFileHandler) : RequestHandler based\n  2) [`StaticFile`](StaticFile)               : Interceptor based\n\n# StaticFileHandler\n`StaticFileHandler` is [RequestHandler](RequestHandler) based. It can be directly added to [Jaguar](Jaguar) server using \n[`addApi`](addApi) method or included in an [Api](Api) using [IncludeApi](IncludeApi) annotation.  \n\n## Usage\n\n```dart\nFuture main() async {\n  final server = new Jaguar();\n  server.addApi(\n      new StaticFileHandler('/public/*', new Directory('./example/static/')));\n  await server.serve();\n}\n```\n\n# StaticFile\n`StaticFile` is an interceptor that substituted [JaguarFile](JaguarFile) in response with actual content of the file \n[JaguarFile] (JaguarFile) points to.\n\n## Usage\n\n```dart\n@Api()\nclass MyApi extends _$MyApi {\n  @Get(path: '/file')\n  @WrapOne(#staticFile)\n  JaguarFile getFile(Context ctx) =\u003e\n      new JaguarFile(Directory.current.path + \"/static/file.css\");\n\n  @Get(path: '/static/:filename*')\n  @WrapOne(#staticFile)\n  JaguarFile getDir(Context ctx) =\u003e new JaguarFile(\n      Directory.current.path + '/static/' + ctx.pathParams['filename']);\n\n  StaticFile staticFile(Context ctx) =\u003e new StaticFile();\n}\n```\n\n[JaguarFile]: https://www.dartdocs.org/documentation/jaguar/latest/jaguar/JaguarFile-class.html\n[Jaguar]: https://www.dartdocs.org/documentation/jaguar/latest/jaguar/Jaguar-class.html\n[IncludeApi]: https://www.dartdocs.org/documentation/jaguar/latest/jaguar/IncludeApi-class.html\n[Api]: https://www.dartdocs.org/documentation/jaguar/latest/jaguar/Api-class.html\n[RequestHandler]: https://www.dartdocs.org/documentation/jaguar/latest/jaguar/RequestHandler-class.html\n[StaticFileHandler]: https://www.dartdocs.org/documentation/jaguar_static_file/latest/jaguar_static_file/StaticFileHandler-class.html\n[StaticFile]: https://www.dartdocs.org/documentation/jaguar_static_file/latest/jaguar_static_file/StaticFile-class.html","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaguar-dart%2Fjaguar_static_file","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaguar-dart%2Fjaguar_static_file","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaguar-dart%2Fjaguar_static_file/lists"}