How to save an attachment returned from an api?

Hello Jessie! Can you be more specific about what you want to do? Do you mind giving an example workflow across the overall k6 test life cycle?

An early guess:

  1. In the init stage, export the users as a CSV.

  2. (Still in init), combine papaparse with a SharedArray to turn the CSV file into an array that your VUs can reference.

    Example of the exact procedure of this step

  3. In the default function, run your VU code and use the CSV-turned-array data as you wish.

If you want to write the API response to a file, you may need to use an extension.
This post explains why, and links some viable extensions: Write data to file - #2 by imiric

I hope that puts you on the right track! If not, at least that’s two for the process of elimination :slight_smile: .