refact file api