almost; very nearly; on the verge of
Used adverbially, often with ところだった or similar expressions, to describe a situation that almost happened but was narrowly avoided. Typically implies a close call or a near miss.
すんでの事で電車に乗り遅れるところだった。
I almost missed the train.
It was very nearly a major accident.