add export format enum and allow export to output stream