File helpers 
From https://gist.github.com/driesvints/6784886