How to process a .zip file from an HTTP Request node in a Python Code Node

Hello, n8n community.

I’m building an n8n workflow in a Docker environment and have run into an issue I’d like to ask about.

Goal:

  1. Download a .zip file (a stock master file) from an external URL using the HTTP Request node.

  2. In the following Code Node (Python), receive this .zip file, unzip it, and parse the .mst file inside to extract a list of stocks.

Current Environment:

  • n8n: Running directly via Docker at http://localhost:5678 (based on the official n8nio/n8n Alpine image).

  • Dockerfile: All necessary system dependencies are installed (e.g., py3-pip, python3-dev, build-base, wget, zip, llvm15-dev). TA-Lib has been compiled from source. requirements.txt (including pykis, pandas, TA-Lib, pandas-ta) is successfully installed using pip install --break-system-packages. The build completes successfully.

  • docker-compose.yml: The following environment variables are set:

    • N8N_PYTHON_EXECUTABLE=/usr/bin/python3

    • N8N_ALLOW_CODE_NODE_EXTERNAL_ACCESS=true

    • N8N_CODE_NODE_FILESYSTEM_ACCESS_MODE=readWriteAll

The Problem:

  • The HTTP Request node successfully downloads the .zip file (I can confirm Mime Type: application/zip and a correct File Size in the output).

  • However, I’m facing an issue in the Code Node:

  • When my Python code tries to directly access the binary.data property from the input (_items), Base64 decode it, and save it to /tmp/filename.zip, the process fails. This triggers my custom error: "ValueError: Could not extract any MST file. Check logs for binary saving errors."

Questions:

  1. What is the correct/most reliable method within a Python Code Node (in this Docker setup) to save the binary data (.zip file) received from the HTTP Request node to a temporary file (e.g., /tmp/filename.zip) so I can unzip and parse it?

  2. I searched with an LLM, and it recommended nodes like “Write Binary File” to specify a path, but such a node doesn’t seem to exist.

  3. If I must process the binary data directly in the Code Node (e.g., from items[0].binary.data), what is the exact property or method I should use to safely save it as a file? (Does this differ by n8n version?)

Any advice would be greatly appreciated. Thank you!