Creating a pre-setup in K6 by saving the response to a file(JSON or CSV)

Hi, I’m using K6 for API testing automation. I want to create a pre-setup k6 script that should call an API and write it’s response body in a separate file like JSON or CSV . Then I should read that JSON or CSV file in another k6 script.
I am able to read a JSON or CSV file but I couldn’t able to write a file.
Can someone help me with this issue, Where I can write the API’s response to JSON or CSV file? I don’t want the --console output command.

Hi @srinath64918

Welcome to the community forum :wave:

Have you tried the extension GitHub - avitalique/xk6-file: k6 extension for writing files?