Extend io function to let user provide a converting function which
converts the data to output data