replaces fs readFileSync, lstatSync and statSync