import type { ConnectionOptions as TLSConnectionOptions } from "node:tls"; import { Client } from "basic-ftp"; import type { Adapter } from "../index.js"; import { FilesError } from "../internal/errors.js"; export interface FtpAdapterOptions { /** FTP host. Falls back to `FTP_HOST`. */ host?: string; /** Port. Falls back to `FTP_PORT`, then `21`. */ port?: number; /** Username. Falls back to `FTP_USERNAME` (alias `FTP_USER`), then `anonymous`. */ user?: string; /** Password. Falls back to `FTP_PASSWORD`. */ password?: string; /** * FTPS over TLS. `true` is preferred explicit TLS (AUTH TLS); `"implicit"` * is legacy implicit TLS. Defaults to `false` — **plain FTP transmits * credentials and data in cleartext; prefer `secure: true`.** Falls back to * `FTP_SECURE` (`"true"` or `"implicit"`). */ secure?: boolean | "implicit"; /** TLS options forwarded to the secure connection (e.g. `rejectUnauthorized`). */ secureOptions?: TLSConnectionOptions; /** * Remote base directory. Virtual keys resolve under it; keys that escape it * (e.g. `../etc/passwd`) throw `Provider`. Defaults to `"."` (the login * directory). An absolute root (`/uploads`) yields absolute paths. */ root?: string; /** * Origin used to build URLs from `url()`. When set, `url(key)` returns * `${publicBaseUrl}/${key}`. When unset, `url()` throws: FTP serves no HTTP * and has no signing primitive. */ publicBaseUrl?: string; /** Socket timeout in milliseconds for new connections (basic-ftp default 30s). */ timeout?: number; /** * Pre-connected `basic-ftp` `Client`. When passed, the adapter reuses it for * every call and never opens or closes a connection — the caller owns the * socket lifecycle. The high-throughput path: connect once and inject rather * than paying a handshake per operation. */ client?: Client; } export type FtpRaw = Client | { connect: () => Promise; }; export type FtpAdapter = Adapter & { readonly root: string; }; export declare const mapFtpError: (err: unknown) => FilesError; export declare const ftp: (opts?: FtpAdapterOptions) => FtpAdapter; //# sourceMappingURL=index.d.ts.map