Closed
Description
Background:
- When serving an embed.FS as an http.FileSystem, it would be nice to have etag support.
- Many file stores (e.g. S3) provide a way to get the MD5 hash of file.
Proposal:
Add a func to io/fs to support getting the hash of file.
Perhaps this?
func Hash(fs FS, h hash.Hash, path string) ([]byte, error)
type Hasher interface {
Hash(h hash.Hash, path string) ([]byte, error)
}
If there's a dependency import issue, maybe put it into package hash.
Ref. #41191 (comment)