add resouce-to-stream pattern