How to output czml

I want to output CZML displayed in cesium to a file.

Please tell me how to achieve

Cesium:1.58

How was the CZML loaded in? If you already have a JSON string of it, you can just output that to a file. There’s nothing special about this for CesiumJS, you can do this directly with JavaScript, like in this answer: https://stackoverflow.com/a/18197341

I’m sorry.
I was trying to get it from CZMLDataSource, but I should use JSON.
Thank you