Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to serve embed.FS files #974

Closed
night-codes opened this issue Feb 20, 2021 · 4 comments · Fixed by #1640
Closed

Ability to serve embed.FS files #974

night-codes opened this issue Feb 20, 2021 · 4 comments · Fixed by #1640

Comments

@night-codes
Copy link

Will there be a native fasthttp way (like .ServeFile) to share filesystems of embedded files, support for which came in go 1.16?

https://golang.org/doc/go1.16#library-embed

@erikdubbelboer
Copy link
Collaborator

A pull request for that would be very welcome. Maybe add a FS fs.FS member to fasthttp.FS and if it's not nil use FS.open instead of os.Open.

@lukekim
Copy link

lukekim commented Jul 19, 2021

@erikdubbelboer with that solution, how might it handle mustCompress? Or just not support it for embedded content?

@erikdubbelboer
Copy link
Collaborator

Yeah I guess that's not supported then.

@byene0923
Copy link
Contributor

I'm willing to try this feature, my basic thought is to add a interface like

StaticFSHandler(prePath string, staticFS fs.FS) RequestHandler

and modify fasthttp.FS as talked above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants