How to run pre-script with newman?

Hi guys,

I would like to create a pre-script for Postman
and run it on console with newman.

Do you have any hint, how to do it?

I saw that it is possible to make an API call, but I would like only to call the pre-script, fetching data and safe the result in external file.


HI @Anton39,
I’m afraid that the way Postman is implemented means that it doesn’t have access to the local file system, so you can not access a local file to save the response to.
If you really need to just call an API endpoint and save the result to a file, why not just use node.js and the fetch method? Node.js scripts have access to the file system and about 12 lines of code should do what you need.
Let me know if you need any further assistance with that.
(you will need to install node-fetch from npm)