Connects, retrieves a single file, then quits.
A one-shot convenience over connect that opens a session, runs FtpSession.get, and closes the connection before returning.
Connection, credential, path, and optional transfer (type/offset) options.
path
type
offset
The file's raw bytes (the tail from opts.offset when set).
opts.offset
If the server rejects the credentials.
If the connection cannot be established.
If the server speaks the protocol incorrectly.
1.0.0
import { getFile } from 'edgeport/ftp';const bytes = await getFile({ hostname: 'ftp.example.com', path: '/pub/readme.txt' });const text = await getFile({ hostname: 'ftp.example.com', path: '/a.txt', type: 'ascii' }); Copy
import { getFile } from 'edgeport/ftp';const bytes = await getFile({ hostname: 'ftp.example.com', path: '/pub/readme.txt' });const text = await getFile({ hostname: 'ftp.example.com', path: '/a.txt', type: 'ascii' });
Connects, retrieves a single file, then quits.
A one-shot convenience over connect that opens a session, runs FtpSession.get, and closes the connection before returning.