# Using HTTP Request for file downloads

**URL:** <https://discourse.nodered.org/t/using-http-request-for-file-downloads/95360>\
**Category:** General\
**Tags:** http-request\
**Created:** [12 February 2025 19:10 UTC](https://discourse.nodered.org/t/using-http-request-for-file-downloads/95360 "2025-02-12T19:10:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jimj](https://avatars.discourse-cdn.com/v4/letter/j/76d3ee/32.png) [@jimj](https://discourse.nodered.org/u/jimj)\
**Post date:** [12 February 2025 19:10 UTC](https://discourse.nodered.org/t/using-http-request-for-file-downloads/95360/1 "2025-02-12T19:10:57Z")

</div>

I'm downloading files from a DAM system for distributing via FTP. My problem is with HTTP Request and file-out. I use these together and the resulting file is always unusable. I've tried with JPG and EPUB (a ZIP) and they can't be opened after download. The request works i.e. I get a payload with the file in it; and the write-file works i.e. I get a file saved on disk. I've tried a variety of return types in HTTP Req and encodings in write-file with no luck. The source file types will vary so I'm looking for a method which will work with any type. Here are the 2 nodes:

[  
{  
"id": "348bff8a3bb6c980",  
"type": "http request",  
"z": "b97ef552ede161d0",  
"name": "",  
"method": "GET",  
"ret": "txt",  
"paytoqs": "ignore",  
"url": "",  
"tls": "",  
"persist": false,  
"proxy": "",  
"insecureHTTPParser": false,  
"authType": "",  
"senderr": false,  
"headers": [  
{  
"keyType": "Authorization",  
"keyValue": "",  
"valueType": "msg",  
"valueValue": "token"  
}  
],  
"x": 690,  
"y": 620,  
"wires": [  
[  
"ef80dbd968629194",  
"fdf09f34a3eb11cf"  
]  
]  
},  
{  
"id": "fdf09f34a3eb11cf",  
"type": "file",  
"z": "b97ef552ede161d0",  
"name": "Save Asset Download",  
"filename": "pathdl",  
"filenameType": "msg",  
"appendNewline": false,  
"createDir": false,  
"overwriteFile": "true",  
"encoding": "utf8",  
"x": 940,  
"y": 620,  
"wires": [  
[  
"f69d1d39b2629628"  
]  
]  
}  
]

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [12 February 2025 19:38 UTC](https://discourse.nodered.org/t/using-http-request-for-file-downloads/95360/2 "2025-02-12T19:38:35Z")

</div>

Have you verified what comes back from the http node with a debug? Show us a screenshot. Do it with parsed and string mode. The file data may be a sub property of the payload.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [12 February 2025 19:39 UTC](https://discourse.nodered.org/t/using-http-request-for-file-downloads/95360/3 "2025-02-12T19:39:50Z")

</div>

Ps, please use a code block when posting code/flow JSON.

* * *

In order to make code readable and usable it is necessary to surround your code with three backticks (also known as a left quote or backquote `````)

````auto
``` 
   code goes here 
```

````

You can edit and correct your post by clicking the pencil ✏ icon.

See this post for more details - [How to share code or flow json](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [13 May 2025 19:40 UTC](https://discourse.nodered.org/t/using-http-request-for-file-downloads/95360/4 "2025-05-13T19:40:50Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
