Read-only connection checks
filezilla-js check connects to an exact saved site, performs the requested read-only checks and closes the connection. Start with the command below, or use the complete Node.js example.
filezilla-js check "Production" --file ./sites.xml --json --host-key-sha256 "SHA256:independently-verified-public-fingerprint"The fingerprint above is a placeholder. Supply the complete SHA256 fingerprint independently verified with the server owner; the command does not trust a key merely because the server presents it.
What runs
By default the command connects and authenticates, then disconnects. It does not list directories or transfer files. A connector may perform protocol negotiation or enter the saved initial directory as part of connection setup. Add --directory for a directory metadata check, and --include-listing for a shallow listing:
filezilla-js check "Production" --file ./sites.xml --host-key-sha256 "SHA256:independently-verified-public-fingerprint" --directory /releases --include-listing --max-entries 100No write, upload, rename, mkdir or delete operation is part of the command. A read-only check still authenticates and creates server-side access logs. FTP metadata inspection can require a directory listing internally because the protocol does not provide a universal single-file stat operation.
Use the same check from code
Install @jalsoedesign/filezilla-core and @jalsoedesign/filezilla-cli. Use the saved SFTP account and verified environment pin from the connection walkthrough. This program connects, authenticates and closes the connection; it neither lists nor writes files. The output below represents success; failures use the result/exit-code contract above.
Save check-site.ts by default, or the filename in the selected language tab. Download: TypeScript · JavaScript · MJS · CommonJS
// check-site.ts
import {checkConnection} from '@jalsoedesign/filezilla-cli';
import {getSiteManager} from '@jalsoedesign/filezilla-core';
const [filename = './sitemanager.xml', selectedPath = 'Production/Web'] = process.argv.slice(2);
const fingerprint = process.env.SFTP_HOST_FINGERPRINT;
const manager = getSiteManager(filename, {credentialPath: selectedPath});
const site = manager.getServerByPath(selectedPath);
if (!site || !fingerprint) {
throw new Error('Supply a saved SFTP site and verified SFTP_HOST_FINGERPRINT.');
}
const result = await checkConnection(site, {hostKeySha256: fingerprint, timeoutMs: 10000});
console.log('Connected:', result.connected);
console.log('Cleanup:', result.cleanup);
process.exitCode = result.exitCode;// check-site.js
import {checkConnection} from '@jalsoedesign/filezilla-cli';
import {getSiteManager} from '@jalsoedesign/filezilla-core';
const [filename = './sitemanager.xml', selectedPath = 'Production/Web'] = process.argv.slice(2);
const fingerprint = process.env.SFTP_HOST_FINGERPRINT;
const manager = getSiteManager(filename, {credentialPath: selectedPath});
const site = manager.getServerByPath(selectedPath);
if (!site || !fingerprint) {
throw new Error('Supply a saved SFTP site and verified SFTP_HOST_FINGERPRINT.');
}
const result = await checkConnection(site, {hostKeySha256: fingerprint, timeoutMs: 10000});
console.log('Connected:', result.connected);
console.log('Cleanup:', result.cleanup);
process.exitCode = result.exitCode;// check-site.mjs
import {checkConnection} from '@jalsoedesign/filezilla-cli';
import {getSiteManager} from '@jalsoedesign/filezilla-core';
const [filename = './sitemanager.xml', selectedPath = 'Production/Web'] = process.argv.slice(2);
const fingerprint = process.env.SFTP_HOST_FINGERPRINT;
const manager = getSiteManager(filename, {credentialPath: selectedPath});
const site = manager.getServerByPath(selectedPath);
if (!site || !fingerprint) {
throw new Error('Supply a saved SFTP site and verified SFTP_HOST_FINGERPRINT.');
}
const result = await checkConnection(site, {hostKeySha256: fingerprint, timeoutMs: 10000});
console.log('Connected:', result.connected);
console.log('Cleanup:', result.cleanup);
process.exitCode = result.exitCode;// check-site.cjs
const {checkConnection} = require('@jalsoedesign/filezilla-cli');
const {getSiteManager} = require('@jalsoedesign/filezilla-core');
async function main() {
const [filename = './sitemanager.xml', selectedPath = 'Production/Web'] = process.argv.slice(2);
const fingerprint = process.env.SFTP_HOST_FINGERPRINT;
const manager = getSiteManager(filename, {credentialPath: selectedPath});
const site = manager.getServerByPath(selectedPath);
if (!site || !fingerprint) {
throw new Error('Supply a saved SFTP site and verified SFTP_HOST_FINGERPRINT.');
}
const result = await checkConnection(site, {hostKeySha256: fingerprint, timeoutMs: 10000});
console.log('Connected:', result.connected);
console.log('Cleanup:', result.cleanup);
process.exitCode = result.exitCode;
}
main().catch(error => {
console.error(error);
process.exitCode = 1;
});Run
npm install --save-dev typescript tsx @types/node
npm pkg set type=module
npx tsx check-site.ts ./sitemanager.xml Production/Webnpm pkg set type=module
node check-site.js ./sitemanager.xml Production/Webnode check-site.mjs ./sitemanager.xml Production/Webnode check-site.cjs ./sitemanager.xml Production/WebOutput
Connected: true
Cleanup: closedThe result uses the same schema and classification as the command. If you need to catch the original typed exceptions in a larger workflow, call the connector's ordinary operations directly instead of using this reporting helper.
Options
| Option | Default | Meaning |
|---|---|---|
<path> | Required | Exact canonical saved-site path; no fuzzy search or duplicate selection. |
--file <xml> | Standard FileZilla locations | Site Manager source. |
--host-key-sha256 <pin> | Required for SFTP | Exact OpenSSH-style SHA256 public host-key fingerprint. Optional trailing base64 padding is accepted. |
--password-stdin | Off | Read a password/passphrase from redirected standard input. |
--directory <path> | Unset | Check that this remote path is an accessible directory. Paths follow the connector's saved initial-directory behavior. |
--include-listing | Off | Include a shallow listing of --directory, or . if no directory is specified. |
--max-entries <count> | 1000 | Maximum listing output entries, from 1 through 100000. Exceeding the limit fails explicitly instead of reporting a truncated success. |
--timeout-ms <ms> | 30000 | Overall deadline, including redirected credential input. Must be a positive integer. |
--json | Off | Emit one versioned JSON result to standard output, including failures. |
See limits and cleanup for deadline, retry and listing-budget behavior.
Credentials and trust
Only the selected site's password is requested from the importer. Other sites remain metadata-only. An explicitly supplied stdin password overrides the saved password; for key authentication it is a passphrase. When stdin is used, saved password contents are not decoded.
Redirect input from the caller's secret provider or a protected descriptor. Passwords are not accepted through command-line arguments. Input is limited to 64 KiB, decoded as UTF-8, and one final LF or CRLF is removed; other whitespace is preserved. Embedded newlines and NUL bytes are rejected. --password-stdin requires redirected input and does not display an interactive terminal prompt. A missing saved credential produces a predictable failure instead of waiting for a prompt.
Supported saved authentication modes are normal password, ask with a supplied stdin password, FTP anonymous and SFTP key files. Interactive, account, profile and ADC modes are rejected by this command; applications can use the richer connector APIs when those workflows are required. SSH agent and keyboard-interactive CLI flags are not provided.
Interactive CLI checks can omit the fingerprint and confirm the displayed host key on standard error. Unattended checks require an exact independently verified host fingerprint. An unapproved host key or mismatched explicit pin cannot receive the password. The command never writes approvals to disk. Unknown hosts require explicit approval; a changed session-approved key requires explicit replacement. Standard TLS certificate verification remains enabled for FTP/FTPS configurations; SSH fingerprint flags are rejected for FTP.
Limits and cleanup
Retries and silent reconnect are disabled for this check. The deadline cancels pending operations; the connector is disconnected on success, failure, cancellation and timeout. Cleanup has a separate two-second ceiling so a stuck cleanup operation cannot indefinitely hang the command. cleanup reports whether it completed; a failed check retains its original failure status if cleanup also fails.
The listing limit bounds output and application iteration. Current connector directory operations may receive a full shallow directory response internally before yielding entries; the option is not a server-side pagination or memory guarantee.
JSON and exit codes
A successful check without optional directory work looks like:
{
"schemaVersion": 1,
"ok": true,
"status": "ok",
"exitCode": 0,
"message": "Connection check completed.",
"stage": "ready",
"connected": true,
"directoryChecked": false,
"cleanup": "closed"
}listing is included only after a successful requested listing. Its entries contain only path, type and a file's size where available. JSON does not contain raw transport messages, exception causes, stacks, credentials, usernames or connection configuration. Listing names are explicitly requested remote metadata and can still be sensitive. Human-readable listing paths are quoted so terminal control characters are escaped.
| Exit | Status | Meaning |
|---|---|---|
0 | ok | Requested checks and cleanup succeeded. |
2 | invalid-options | Invalid, unknown or missing command options. |
3 | trust-rejected | Missing/mismatched SFTP pin or failed TLS/server trust. |
4 | authentication-failed | The server rejected authentication. |
5 | unsupported-protocol | Unsupported protocol, authentication mode or required connector capability. |
5 | client-not-installed | Required optional Dockline client is missing; the message includes its installation command. |
6 | connection-failed | DNS, connection refusal or another connection failure. |
7 | directory-failed | Directory lookup, listing or permission failure. |
8 | credentials-required | No usable credential, invalid redirected credential input or unavailable provider. |
9 | invalid-site | Invalid source XML, missing source file or non-unique/unavailable exact selection. |
10 | cleanup-failed | The requested checks succeeded but disconnect did not finish successfully. |
11 | listing-limit | Optional listing exceeded its entry budget. |
124 | timeout | Overall or operation deadline exceeded. |
130 | cancelled | Cancellation, including SIGINT/SIGTERM when delivered by the operating system. |
stage preserves a documented typed connector stage when available: resolve, connect, trust, authenticate, credentials or directory. Command-owned stages include input, list, cleanup and ready. A stage is context, not a guarantee that every preceding network substep was observed independently. The cleanup field is not-required, closed or failed.