Creates a directory and all missing parents, like mkdir -p.
FTP MKD is single-level, so this splits path on / and issues MKD for each
cumulative segment, ignoring the 550 "already exists" failure on segments that are
already present. A leading / is preserved so absolute paths create from the root; a
relative path creates under the current working directory. This is a client-side walk:
it makes one round trip per segment and is not atomic.
Directory path to create, with / separating segments.
Reports whether a path exists by probing it with SIZE.
Issues SIZE <path> and treats a 213 reply as existence and a 550 (or any other
command failure surfaced as ProtocolError) as absence. Because SIZE is a
file-oriented probe, some servers reject it for directories even when they exist; for a
directory, prefer FtpSession.cwd or FtpSession.list. The path is
resolved by the server relative to the current working directory unless it is absolute.
Path to probe (absolute, or relative to the working directory).
true if the server reports a size for the path, false if it is missing.
Retrieves a file's bytes via RETR.
Defaults to binary (TYPE I). Pass { type: 'ascii' } for a text-mode transfer (TYPE A,
server line-ending conversion) or { offset } to resume an interrupted download from a byte
offset (REST <offset> before RETR), in which case the returned bytes are the tail of the
file from that offset.
Path of the file to fetch.
Optionalopts: FtpGetOptions
Optional transfer type and resume offset.
The file's raw bytes (the tail from opts.offset when set).
Retrieves a file and parses it as JSON.
A convenience over FtpSession.get that decodes the bytes as UTF-8 and runs
JSON.parse. The type parameter T annotates the parsed shape; it is not validated at
runtime.
The expected shape of the parsed JSON.
Path of the JSON file to fetch.
The parsed value, typed as T.
Retrieves a file as a stream via RETR, for payloads too large to buffer.
The returned stream owns the data connection; read it to completion (or cancel it) so the
underlying socket closes. Accepts the same type and offset options as FtpSession.get.
Path of the file to fetch.
Optionalopts: FtpGetOptions
Optional transfer type and resume offset.
A readable stream of the file's bytes.
Retrieves a file and decodes its bytes as UTF-8 text.
A convenience over FtpSession.get that runs the same RETR transfer and decodes
the result with TextDecoder. Accepts the same transfer options as get.
Path of the file to fetch.
Optionalopts: FtpGetOptions
Optional transfer type and resume offset (see FtpGetOptions).
The file contents decoded as UTF-8.
Returns a file's last-modified time via MDTM.
Issues MDTM <path> and parses the 213 YYYYMMDDHHMMSS reply as a UTC timestamp. Per
RFC 3659 the MDTM time is always UTC. A fractional-seconds suffix (.sss), when the
server sends one, is parsed too. The path is resolved by the server relative to the
current working directory unless it is absolute.
Path of the file to stat.
The modification time as a Date.
Stores bytes to a file via STOR (or APPE).
Defaults to binary (TYPE I). Pass { type: 'ascii' } for a text-mode transfer, or resume
an interrupted upload with { append: true } (use APPE, sending only the remaining bytes)
or { offset } (issue REST <offset> before STOR, overwriting from that offset).
Destination path.
The bytes to write.
Optionalopts: FtpPutOptions
Optional transfer type and resume mode (append or offset).
Serializes a value as JSON and stores it via STOR.
A convenience over FtpSession.put that runs JSON.stringify, encodes the result
as UTF-8, and uploads it.
Destination path.
The value to serialize; must be JSON-serializable.
Optionalopts: { space?: number }
Optional formatting; space is forwarded to JSON.stringify for indentation.
Encodes a string as UTF-8 and stores it via STOR.
A convenience over FtpSession.put that encodes content with TextEncoder
and uploads it. Accepts the same transfer options as put.
Destination path.
The text to write; encoded as UTF-8.
Optionalopts: FtpPutOptions
Optional transfer type and resume mode (see FtpPutOptions).
Recursively deletes a directory tree (files then directories, depth-first).
Walks path with LIST, deleting files with DELE and recursing into subdirectories,
then removes each emptied directory with RMD. This is a client-side walk: it makes many
round trips (O(N) for N entries) and is not atomic, so a failure partway through
leaves the tree partly deleted. Rejects when path is empty or / as a guard against
wiping the server root. The path is resolved by the server relative to the current
working directory unless it is absolute.
Directory tree to remove; must not be empty or /.
An authenticated FTP session over a single control connection.
Obtain one from connect. It is an
AsyncDisposable, so it can be scoped withawait usingto guarantee a cleanQUITand socket close. Methods issue one command at a time and must not be called concurrently on the same session, since each data transfer opens its own passive connection while the control channel is in use.Since
1.0.0