The present technology is a peristaltic pump that enables bidirectional fluid flow with nanoliter precision. The pump is comprised of a series of wire actuators comprised of a nickel titanium alloy (nitinol) that control fluid flow within a tube or channel. Nitinol is MRI-compatible and has a high electrical resistance which drives ohmic heating when current is passed through the wire. This heat triggers a martensite to austenite phase transition in the nitinol, leading to physical contraction of the wire. Wire contraction displaces fluid within the tube. Sequential contraction of the wire actuators thus drives directional fluid flow. The direction and rate of fluid flow is regulated by the specific, changeable sequence of wire contractions within the actuator series. This mechanism enables precisely controlled bidirectional fluid flow with nanoliter precision, which can facilitate both liquid biopsy, such as cerebrospinal fluid sampling, as well as drug delivery when the pump is interfaced with an implant in the target tissue, such as a patient’s brain. The pump can be manufactured and used in either an implantable or wearable form, with a wearable detachable form being preferable for pump designs that contain control circuitry or batteries that are not MRI-compatible.