fasthttp
fasthttp copied to clipboard
Ability to serve embed.FS files
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
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
.
@erikdubbelboer with that solution, how might it handle mustCompress
? Or just not support it for embedded content?
Yeah I guess that's not supported then.
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