Export variable to file

Hi Team,

I am trying to export response to text file. I have tried nodejs module β€œfs” - but fails with error "Error running scripts: Error | Cannot find module β€˜fs’.

Is there any way in postman to write response to file?

Thanks.

Hey @SatejMirpagar, inbuilt node libraries like fs have been disabled in the postman sandbox for the reasons of security. An alternative is to use Newman, Postman’s CLI companion. A working example is provided here: https://github.com/postmanlabs/newman/issues/413#issuecomment-316116450

An alternative to the above approach has been described here: http://blog.getpostman.com/2017/09/01/write-to-your-local-file-system-using-a-postman-collection/

Thanks mate, appreciate it.