saving result of render to a file

I’m looking for example code that shows how to save the result of a render to a .png (or other image format).

Anyone have example code?

Looking around, I think what I need to do is write some sort of task, since tasks are handled each frame. Can I then grab the frame buffer, and save it out?


I see that there are saveScreenshot functions, so nevermind. Sorry I didn’t see those at first.