When the defendant is brought before a magistrate upon an arrest, either with or without a warrant, on a charge of having committed a public offense, the magistrate must immediately inform him of the charge against him, and of his right to the aid of counsel in every stage of the proceedings, and also of his right to waive an examination before any further proceedings are had.
R.L.1910, § 5667.