add toFile function for fbp and wukongsystem.