Overview
This node, named "HjhCheckArgs," is designed to verify the contents of a specified key file against a provided key string. It reads the content of a file from a given path and compares it with a user-supplied key in JSON format. If the contents match, the node outputs a success message; otherwise, it throws an error.
This node is useful in scenarios where you need to validate or authenticate a key file before proceeding with further workflow steps. For example, it can be used to ensure that a configuration or license key file matches expected credentials before executing sensitive operations.
Properties
| Name | Meaning |
|---|---|
| Hjh Key File | The file path to the key file that will be read and checked. |
| Hjh Key | The key string in JSON format to compare against the contents of the key file. |
Output
The node outputs a JSON array containing an object with the following structure:
code: HTTP-like status code (200 for success, 400 for failure).message: A short status message ("ok" on success or the error message on failure).description: Detailed description of the result or error.hjhKey: The key string that was checked.
If the key file content matches the provided key, the output indicates success (code: 200). If there is a mismatch or an error reading the file, the output contains error details (code: 400).
The node does not output any binary data.
Example successful output:
[
{
"code": 200,
"message": "ok",
"description": "ok",
"hjhKey": "<provided key string>"
}
]
Example error output:
[
{
"code": 400,
"hjhKey": "<provided key string>",
"message": "<error message>",
"description": "<detailed error description including stack trace>"
}
]
Dependencies
- Requires access to the local filesystem to read the key file.
- No external API or service dependencies.
- No special credentials are required beyond file system permissions.
Troubleshooting
Common issues:
- File not found or incorrect file path: The node will throw an error if the specified key file path is invalid or inaccessible.
- Mismatch between file content and provided key: The node will report an error indicating the check failed.
- File read permission errors: Ensure the n8n process has permission to read the specified file.
Error messages:
"check key file :<file path>"error indicates the file content did not match the provided key.- File system errors such as "ENOENT" indicate the file could not be found.
Resolution:
- Verify the file path is correct and accessible.
- Confirm the key string matches exactly the content of the file (ignoring line breaks and whitespace).
- Check file permissions for the user running n8n.