Where does the expression “by the skin of one’s teeth” come from and What does it mean?

The use of the expression “by the skin of one’s teeth” is always in respect to some calamity that has been avoided by so narrow a margin as to be measurable by the lining of a tooth.

But originally, as found in Job xix, an, the preposition “with” was used, not “by”, “And I am escaped with the skin of my teeth.” But Job meant that he had escaped with nothing left but the skin of his teeth.

The modern American expression and its meaning did not appear until approximately the beginning of the nineteenth century.