calling function to get stream when piping