APIs to implement File -> SaveAs of BPMN diagram

I have a requirement to implement File -> SaveAs functionality to BPMN diagram. Sample code is storing data in localStorage which will be cleared when user clears browser cache. Want to know if we have any apis to create a text or json file from BPMN diagram and save the file to user selected location (Ex: C:\Temp).

I am looking for something similar to notepad File -> SaveAs

Usually data is saved to the server, using wharever protocols and databases that the web app wants to use.

Also consider GoJS Storage -- Northwoods Software.

Already gone through above shared link. We have different requirement to store locally.

You’ll have to implement that yourself.