Read file in custom extension

In a custom module you first need to convert the path to any file as described here.