This logic seems wrong. Consider a case where the callback throws, not the readFileSync call. In that case, the callback would be called, throw, and then be called again with the error it itself threw.