Detect module and output format for given file