# Access environment using newman terminal command

**URL:** <https://community.postman.com/t/access-environment-using-newman-terminal-command/22229>\
**Category:** Help Hub\
**Tags:** newman-project, tests\
**Created:** [April 3, 2021, 9:12am UTC](https://community.postman.com/t/access-environment-using-newman-terminal-command/22229 "2021-04-03T09:12:59Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [April 3, 2021, 9:29am UTC](https://community.postman.com/t/access-environment-using-newman-terminal-command/22229/5 "2021-04-03T09:29:59Z")

</div>

Posts like this have shown different ways that items can be written to a file.

> [@How to Save Get response to local file?](https://community.postman.com/t/how-to-save-get-response-to-local-file/17942/2):
>
> Hey @bukhari.adac This is a very common question and doing a quick search in the forum would have returned a few different ways of writing those to file. grin Using Newman as a library and paring that with the Node fs module you can save the responses to a file like this: const newman = require('newman'), fs = require('fs'); newman.run({ collection: '\<Postman Collection\>' }).on('request', (err, args) =\> { fs.writeFile(`./results/${args.item.name}.json`, args.response.stream, (err…

---

_[View the full topic](https://community.postman.com/t/access-environment-using-newman-terminal-command/22229)._
