Downloading svg from bpmn file

I have a dashboard where I can upload bpmn files. I want to add a button next to each file to download it as svg without actually viewing the model. How can I do this? Any help is appreciated. Thanks!

I have not tried it, but it is possible to dynamically attach/detach the viewer: GitHub - bpmn-io/bpmn-js: A BPMN 2.0 rendering toolkit and web modeler.

Combining this with the saveSVG method from the Viewer, it might achieve what you need.

Thank you that worked!