Read arg from file then output sorted result by distance, js implement