Consul is a distributed, highly available, and data center aware solution to connect and configure applications across dynamic, distributed infrastructure.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
616 B

package uiserver
import (
"io"
"io/fs"
)
// bufferedFile implements fs.File and allows us to modify a file from disk by
// writing out the new version into a buffer and then serving file reads from
// that.
type bufferedFile struct {
buf io.Reader
info fs.FileInfo
}
func (b *bufferedFile) Stat() (fs.FileInfo, error) {
return b.info, nil
}
func (b *bufferedFile) Read(bytes []byte) (int, error) {
return b.buf.Read(bytes)
}
func (b *bufferedFile) Close() error {
return nil
}
func newBufferedFile(buf io.Reader, info fs.FileInfo) *bufferedFile {
return &bufferedFile{
buf: buf,
info: info,
}
}