Whenever in any criminal proceeding in any of the courts of this State a bond, recognizance or undertaking is authorized or required to be given, the party authorized or required to give it may deposit in lieu thereof a sum of lawful money of the United States of America equal in amount to the bond, recognizance or undertaking so required or authorized to be given. Such sum of money, when deposited as in this section provided, shall be held and taken as equivalent in all respects to the giving of such bond, recognizance or undertaking.