How File Storage Works in n8n (And How to Use It Safely)

🗂 Relative Paths: Where Is ./filename
?
When using the Write Binary File or Read Binary File node, a relative path like ./file.txt
is resolved relative to the n8n process's working directory. On both self-hosted and n8n Cloud, this typically means somewhere inside n8n’s internal runtime folder (such as /home/node/
).
➡️ Important: On n8n Cloud, these nodes are available, but you must use relative paths like ./filename
. Absolute paths will not work and will throw an error.
💻 Self-Hosted: Use Mounted Volumes for Persistence
In self-hosted setups, especially with Docker, relative paths like ./file.txt
are resolved inside the container. If you want files to persist or be accessible from the host system, mount a directory and use absolute paths (e.g. /files/image.jpg
).
➡️ Best practice: Mount a folder like ~/n8n-files
to /files
in Docker, then write to /files/filename.ext
.
🔐 Cloud: Use Relative Paths Cautiously
On n8n Cloud, you can write and read files using relative paths like ./filename.txt
, and they do persist between workflow runs. However, this storage is not intended for long-term use—files may be lost if your cloud instance is updated or reset during infrastructure changes.
➡️ Cloud-friendly tip: Use the local path only for temporary needs. For important files, always upload them to a permanent external service like Google Drive, S3, or Dropbox.
💾 Temporary vs. Persistent Storage
- Temporary storage is handled in memory by default. If you enable
N8N_DEFAULT_BINARY_DATA_MODE=filesystem
, n8n will use its internal temp directory (typically under.n8n/binaryData
) and automatically delete files after use. - Persistent storage (for long-term access) must be configured manually on self-hosted setups—n8n doesn’t manage or clean up files outside its internal folders.
➡️ Reminder: Files written manually (e.g., via Write Binary File) won’t be cleaned up unless your workflow deletes them.
🚮 Clean Up After Yourself
If your workflow writes files for short-term use (especially on self-hosted), consider deleting them at the end of the workflow using an Execute Command node (e.g., rm ./tempfile.zip
).