I have been learning n8n for a week, and I have been trying to read a CSV file from a disk and then convert it into JSON file. Pretty standart workflow, but somehow I could not manage it. (There is an old version solution by “Read Binary File” node on forums, but I cannot find it through my nodes on my own Canvas)
Output: Nodes function properly, but after “Read/Write File From Disk” node, it “probably”(just guessing) reads and returns an empty file, so “Convert fo File” functions properly but returns also nothing. (Screenshot4:
I see that the ‘Read/Write Files from Disk’ node is accessing a file on your desktop. Did you actually set up your Docker environment to have access to that directory, and is the node outputting any data? By default, n8n won’t have access to it.
Ah thank you for that! Also a new Docker user here so did not know I have to do that. So first problem is indeed setting up my Docker environment to have access to that directory, let me learn that cause I have no idea how to do it :))
What you need to do is set up a volume inside docker that mounts a local directory. If you’re using docker-compose.yml, you’ll see a section called ‘volumes’. You can add a line to it to map a local directory to a directory inside the docker environment, like:
volumes:
- ${DATA_FOLDER}/.n8n:/home/node/.n8n
- local directory path:/files
After restarting your n8n instance, you can access files in the /files directory.
Please ready Manage data in Docker | Docker Docs for details - especially on Windows you need to pay attention to how you format the file path.
Now, I need to update an endpoint with that JSON file, let me spend my own time for that, if I cannot learn/figure out it; I can create another thread.