Capture stdin to a file while also continuing to send it to a program in bash

If I have a bash script such as



where foo is a long running program that continuously receives input through stdin and performs actions, How can I pipe the incoming stdin stream to a file, while also sending it along to foo as usual?