How to save data of depth map and RGB images in "real-time"?

It is possible to save the .obj after completing a scan of an object; however, I want to save the depth-map and RGB images in “real-time” for the Mark II sensor. How can I extract that information at any time and save the depth-map and RGB images in a folder?

Take a look at STOccFileWriter