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

Implement io.Writer for File #129

Open
mattes opened this issue Jan 9, 2019 · 2 comments
Open

Implement io.Writer for File #129

mattes opened this issue Jan 9, 2019 · 2 comments

Comments

@mattes
Copy link

mattes commented Jan 9, 2019

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()).

@GeertJohan
Copy link
Owner

GeertJohan commented Feb 8, 2019

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
Copy link
Owner

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

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

No branches or pull requests

2 participants