Except as provided in section 2A:81-21 of this Title, a witness shall be privileged from arrest in all civil actions, and no other, during necessary attendance at court or other place, required by subpoena previously duly served, and during his going to and returning therefrom, allowing 1 day for every 30 miles from his place of residence.
Any arrest made in violation of the privilege given by this section shall be a contempt of the court out of which the subpoena issued, and the court, may, by an order, forthwith discharge the witness from arrest.
N.J.S. § 2A:81-17