base: File API

Missing:

* Binary files
* File removals
* Unit tests
* Docs as docbook, fix typos etc
I think this should be 'replace' not 'write'.