Write to a transform stream and read the output using a function