{"id":19673710,"url":"https://github.com/infinimesh/http-fs","last_synced_at":"2025-02-27T05:23:36.176Z","repository":{"id":96768100,"uuid":"493303338","full_name":"infinimesh/http-fs","owner":"infinimesh","description":"HTTP File Server written in Go","archived":false,"fork":false,"pushed_at":"2023-03-07T02:34:36.000Z","size":120,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-10T04:12:04.397Z","etag":null,"topics":["docker","file-upload","go","golang","http","infinimesh"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/infinimesh.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":"2022-05-17T15:11:13.000Z","updated_at":"2022-05-17T22:51:43.000Z","dependencies_parsed_at":"2023-05-21T21:00:43.925Z","dependency_job_id":null,"html_url":"https://github.com/infinimesh/http-fs","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/infinimesh%2Fhttp-fs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/infinimesh%2Fhttp-fs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/infinimesh%2Fhttp-fs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/infinimesh%2Fhttp-fs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/infinimesh","download_url":"https://codeload.github.com/infinimesh/http-fs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240982762,"owners_count":19888569,"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":["docker","file-upload","go","golang","http","infinimesh"],"created_at":"2024-11-11T17:16:05.573Z","updated_at":"2025-02-27T05:23:36.013Z","avatar_url":"https://github.com/infinimesh.png","language":"Go","readme":"# infinimesh HTTP FileServer\n\n[![Build Docker Images](https://github.com/infinimesh/http-fs/actions/workflows/ci.yml/badge.svg)](https://github.com/infinimesh/http-fs/actions/workflows/ci.yml)\n\nSimple HTTP FileServer made for infimesh, but can be extended and applied for other services with simillar purposes.\n\nRight now only FileSystem storage is supported.\n\n## General logic\n\nServer understands two things:\n\n- namespaces (folders)\n- files (well, just files)\n\nSo these are routes:\n\nGET /{ns} - returns stats (files and their props) in the requested namespace\nDELETE /{ns} - deletes namespace(and its files)\nGET /{ns}/{file} - returns file itself\nPOST /{ns}/{file} - uploads file\nDELETE /{ns}/{file} - deletes file\n\nSee the [Postman Collection](https://github.com/infinimesh/http-fs/blob/master/misc/http-fs.json) to try it yourself.\n\n## Installation\n\nDocker(compose) service example:\n\n```yaml\n    http-fs:\n        image: ghcr.io/infinimesh/http-fs:latest\n        restart: always\n        ports:\n            - \"80:8000\"\n        environment:\n            ADDR: :8000\n            REPO: repo:8000\n            STATIC_DIR: /static # you should probably map this to some real volume\n            UPLOAD_LIMIT: 10485760 # 10MB\n            LOG_LEVEL: -1 # -1 for debug, 0 for info, 1 for warning, 2 for error (defaults to info)\n```\n\n## Default logic\n\nNamespaces are mapped to:\n\n1. infinimesh namespaces - middleware determines access to the folder basing on the user's permissions\n2. filesystem directory\n\nThese is the result of using [InfinimeshMiddleware](https://github.com/infinimesh/http-fs/blob/master/pkg/mw/infinimesh.go) and [FileSystem](https://github.com/infinimesh/http-fs/blob/2052af2e6f9ffa67bcb0c2cdbf1ac9f54e550bfd/pkg/io/fs/fs.go) [IOHandler](https://github.com/infinimesh/http-fs/blob/master/pkg/io/fs/fs.go#L17)\n\n## How to extend\n\n### Middleware\n\nMiddleware is a `mux` middleware which adds `Access` to context.\n\nAccess defined [here](https://github.com/infinimesh/http-fs/blob/2052af2e6f9ffa67bcb0c2cdbf1ac9f54e550bfd/pkg/mw/mw.go). It's a simple structure which defined if requestor has Read and Write access to the namespace/file.\n\nYou can also see the [SampleMiddleware](https://github.com/infinimesh/http-fs/blob/master/pkg/mw/sample.go) to (maybe) get a better idea.\n\n### IOHandler\n\nIOHandler is an interface which has few methods decribed [here](https://github.com/infinimesh/http-fs/blob/master/pkg/io/io.go#L18)\n\n### Building\n\nReplace used middlewares and IOHandler with your own and compile.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finfinimesh%2Fhttp-fs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finfinimesh%2Fhttp-fs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finfinimesh%2Fhttp-fs/lists"}