@codeplaydata/datasus
Version:
This application decompress the datasus micro data and serve as a gateway class.
42 lines (41 loc) • 1.78 kB
TypeScript
import { Client as FtpClient } from "basic-ftp/dist/Client.js";
import { FTPClient } from "./FTPClient.js";
/**
* FTP client based on the basic-ftp library.
*
* This minimal implementation wraps the library client and provides a list and
* download operations, plus a factory method to establish a connection.
*/
export declare class BasicFTPClient implements FTPClient {
readonly client: FtpClient;
/**
* Private constructor. Use the static connect method to create instances.
* @param client An already authenticated/accessible basic-ftp client instance.
*/
private constructor();
/**
* Establishes a connection to the given FTP host.
* @param host FTP server address (e.g., ftp.datasus.gov.br).
* @returns An instance of BasicFTPClient on success.
* @throws CouldNotConnect when the connection cannot be established.
*/
static connect(host: string): Promise<BasicFTPClient | undefined>;
/**
* Lists entries from an FTP directory.
* @param path Server path. Defaults to '/'.
* @returns The list of entries returned by the basic-ftp library.
*/
list(path?: string): Promise<import("basic-ftp/dist/FileInfo.js").FileInfo[]>;
/**
* Downloads a remote file.
* If the destination file already exists, it will not be downloaded again.
* @param dest Local full path for the destination file.
* @param from Remote full path on the FTP server (source).
* @returns A Promise resolved when the download completes, or undefined if the file already exists.
*/
download(dest: string, from: string): Promise<import("basic-ftp/dist/FtpContext.js").FTPResponse | undefined>;
/**
* Closes the connection with the FTP server.
*/
close(): void;
}