use promise to speed up file checking