Skip to content
Reference

Adapter: Local File (mounted volume)

Read and write files in a folder mounted into the engine (Mirth File Reader/Writer, FILE scheme).

On this page

Purpose

Read, write, list, move and delete files in a folder on a volume mounted into the engine container: the FILE scheme of a Mirth File Reader or File Writer. Pick files up from it with the file pickup trigger.

Auth

  • No login: the engine's own file access.
  • The operator decides which folders any profile may use. FILE_ADAPTER_ROOTS lists them (comma-separated absolute paths); the Helm chart sets it from fileAdapter.mounts, which also mounts each volume. With no roots set, every read and write is refused.
  • baseDir must be one of those folders or inside one, after symlinks are resolved. A profile outside them saves with a warning, and every step through it is refused until the operator allows the folder.

Settings

Auth is none. Dotted names are fields inside an object setting. Secret settings are encrypted at rest, never returned by a read, and shown masked in the console and in exports; their defaults are not shown.

SettingTypeRequiredDefaultSecretDescription
baseDirstringYesNoAbsolute folder on a mounted volume; it must be inside one of the folders the operator lists in FILE_ADAPTER_ROOTS.
maxFileBytesnumberNo52428800NoLargest file a read step loads into memory (bytes).
uploadModeenum: temp-rename, directNotemp-renameNotemp-rename writes a hidden .part file then renames it; direct writes the final name.
writeModeenum: overwrite, append, error-if-existsNooverwriteNooverwrite replaces an existing file; append adds to it (written directly); error-if-exists fails the step.
createDirsbooleanNofalseNoCreate the parent directory before writing.

Actions

A trailing ? marks an optional step parameter. A message can supply only the keys in the last column; everything else comes from the step.

ActionWhat it doesStep parametersKeys a message may supply
downloadRead a file from the folder.remotePath, encoding?None
uploadWrite a file to the folder.remotePath, filenamePattern?, content?content
listList files in a directory.remotePath?None
deleteDelete a file.remotePathNone
renameMove (rename) a file.fromPath, toPathNone

Minimal example

The smallest profile the engine accepts: the required settings only, with synthetic values. Create it with POST /api/adapter-profiles, then test it with POST /api/adapter-profiles/{id}/test.

json
{
  "name": "Local File (mounted volume) (example)",
  "adapterType": "file",
  "config": {
    "baseDir": "/mnt/medhook/inbound"
  }
}

Limits

  • Every path is relative to baseDir (/ is baseDir itself). A . or .. segment, a backslash or a NUL byte is refused, not normalised. A symlinked folder that leads out of baseDir is refused, and a symlinked file is never opened (O_NOFOLLOW).
  • Every read, write, move, delete and listing goes through its folder opened without following symlinks and checked again after the open (on Linux through /proc/self/fd), so a folder swapped for a symlink while the engine works is refused, not followed.
  • A file with more than one hard link is not read: a hard link could make a file outside baseDir appear inside it.
  • Writes go to a hidden .part file in the same folder and are renamed onto the final name by default (uploadMode), so a reader never sees half a file. writeMode picks overwrite, append (written directly) or fail when the file exists.
  • A move never replaces an existing file. On a volume without hard links it checks for the target, then renames.
  • Error messages name the call and the error code, never the host path.
  • Reads load the whole file into memory, up to maxFileBytes.

Reference