# Download file when send request

**URL:** <https://community.postman.com/t/download-file-when-send-request/2471>\
**Category:** Help Hub\
**Tags:** tests\
**Created:** [August 22, 2018, 2:08am UTC](https://community.postman.com/t/download-file-when-send-request/2471 "2018-08-22T02:08:24Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![su.ziying](https://avatars.discourse-cdn.com/v4/letter/s/73ab20/32.png) [@su.ziying](https://community.postman.com/u/su.ziying)\
**Post date:** [August 22, 2018, 2:08am UTC](https://community.postman.com/t/download-file-when-send-request/2471/1 "2018-08-22T02:08:24Z")

</div>

Hi guys,  
Now I have an interface which use to download file. Is there any way to download file when I send the request but without click [Send and download] button ? For example, can I do this with writing some code in the ‘Test handling’ area or other programming way ?

---

<div class="post-metadata">

**Author:** ![singhsivcan](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/singhsivcan/32/1595_2.png) [@singhsivcan](https://community.postman.com/u/singhsivcan)\
**Post date:** [October 12, 2018, 8:42am UTC](https://community.postman.com/t/download-file-when-send-request/2471/2 "2018-10-12T08:42:36Z")

</div>

@su.ziying[https://documenter.getpostman.com/view/3407886/RWgp1fB5](https://documenter.getpostman.com/view/3407886/RWgp1fB5)

---

<div class="post-metadata">

**Author:** ![saveuser12345](https://avatars.discourse-cdn.com/v4/letter/s/e95f7d/32.png) [@saveuser12345](https://community.postman.com/u/saveuser12345)\
**Post date:** [September 6, 2019, 10:18pm UTC](https://community.postman.com/t/download-file-when-send-request/2471/3 "2019-09-06T22:18:57Z")

</div>

I am not able to open the attached link it is throwing 404 error . I have similar requirement can you please help.

---

<div class="post-metadata">

**Author:** ![singhsivcan](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/singhsivcan/32/1595_2.png) [@singhsivcan](https://community.postman.com/u/singhsivcan)\
**Post date:** [September 8, 2019, 7:19am UTC](https://community.postman.com/t/download-file-when-send-request/2471/4 "2019-09-08T07:19:24Z")

</div>

Weird, the link isn’t giving 404 for me.

But anyway, Just go to the app click on “New” \> “Templates” \> Search for “Write Response” and use that template by clicking “Run in Postman”.

 ![image](https://us1.discourse-cdn.com/getpostman/original/2X/f/f897dc7be2241099712862a73bd5690b96823583.png)

The template has all the instructions that will be required.

---

<div class="post-metadata">

**Author:** ![bharat.r](https://avatars.discourse-cdn.com/v4/letter/b/c2a13f/32.png) [@bharat.r](https://community.postman.com/u/bharat.r)\
**Post date:** [June 3, 2020, 9:19am UTC](https://community.postman.com/t/download-file-when-send-request/2471/6 "2020-06-03T09:19:48Z")

</div>

Its not working with octet stream what can we do to complete that.

---

<div class="post-metadata">

**Author:** ![frans1980](https://avatars.discourse-cdn.com/v4/letter/f/3be4f8/32.png) [@frans1980](https://community.postman.com/u/frans1980)\
**Post date:** [December 7, 2020, 1:25pm UTC](https://community.postman.com/t/download-file-when-send-request/2471/7 "2020-12-07T13:25:46Z")

</div>

This requires starting up an external (outside of Postman) NodeJS app first.

Is there any way to do this within Postman (i.e. on the **Test** or **Pre-request Scripts** Tab)? (It doesn’t seem so, since the Postman script sandbox doesn’t supply the NodeJS file library.)

---

<div class="post-metadata">

**Author:** ![odanylewycz](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/odanylewycz/32/3240_2.png) [@odanylewycz](https://community.postman.com/u/odanylewycz)\
**Post date:** [December 10, 2020, 2:00pm UTC](https://community.postman.com/t/download-file-when-send-request/2471/8 "2020-12-10T14:00:18Z")

</div>

Hi @bharat.r,

Can you show us a screenshot of the octet stream you are getting back? If its base64 encoded, you can use Postman Visualizer to create a “web page” where you set the value of the `window.location.href = "yourBase64OctetStream"` in your visualizer template, which should initiate a download.

Granted, depending on what the file is, your operating system might not know how to open the file. If you can specify the file type, such as ‘application/pdf’, it should save as the proper file format, and then can be opened without the OS having to guess what it is.

Hope this helps!

Best,  
Orest

---

<div class="post-metadata">

**Author:** ![m234461](https://avatars.discourse-cdn.com/v4/letter/m/cdc98d/32.png) [@m234461](https://community.postman.com/u/m234461)\
**Post date:** [June 16, 2021, 8:55pm UTC](https://community.postman.com/t/download-file-when-send-request/2471/9 "2021-06-16T20:55:42Z")

</div>

@singhsivcan Hi, i have similar issue facing i.e not able to download .wav or mp3 format via collection. I am running a collection which is able to download the content (as symbols) however i would need to get in .wav file to play the audio. For this to work send with download when run the collection . Could you assist me what changes required in order to send with download work?

Govinda
