How does preserving food in salt work?

Sodium chloride absorb water and as a consequence all microorganisms are destroyed.