lib: revamp the file API, adding `Path` and `FileStat`

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>