Added callback feature

Useful when you want to use fileHandler() at the api level.