go.rice icon indicating copy to clipboard operation
go.rice copied to clipboard

Implement io.Writer for File

Open mattes opened this issue 7 years ago • 2 comments

It would be nice if type File would implement io.Writer. That way I could update some static files on the fly when served via http.FileServer(box.HTTPBox()).

mattes avatar Jan 09 '19 01:01 mattes

So, writing to the file would completely overwrite? Or would it append? I'm not sure if this is something rice should do itself; or if it would be something for a layer in between http.FileServer and box.HTTPBox().

It would probably be cleaner to implement a separate package that provides a http.FileSystem by wrapping an existing http.FileSystem (e.g. box.HTTPBox()), but allows for modifications/overwrites. It first checks its local changeset, if there's no matching file, then forwards the Open(..) call to the wrapped http.FileSystem.

GeertJohan avatar Feb 08 '19 09:02 GeertJohan

Probably interesting to look at for this: https://github.com/spf13/afero

GeertJohan avatar Feb 08 '19 09:02 GeertJohan