base: File API

Missing:

* Binary files
* File removals
* Unit tests
* Docs as docbook, fix typos etc
See streaming-cleanup branch for buffering helpers to implement this in a more efficient way.