transfer.d.ts 1.3 KB

12345678910111213141516171819202122232425262728293031323334
  1. /// <reference types="node" />
  2. import { Writable, Readable } from "stream";
  3. import { FTPContext, FTPResponse } from "./FtpContext";
  4. import { ProgressTracker, ProgressType } from "./ProgressTracker";
  5. export type UploadCommand = "STOR" | "APPE";
  6. /**
  7. * Prepare a data socket using passive mode over IPv6.
  8. */
  9. export declare function enterPassiveModeIPv6(ftp: FTPContext): Promise<FTPResponse>;
  10. /**
  11. * Parse an EPSV response. Returns only the port as in EPSV the host of the control connection is used.
  12. */
  13. export declare function parseEpsvResponse(message: string): number;
  14. /**
  15. * Prepare a data socket using passive mode over IPv4.
  16. */
  17. export declare function enterPassiveModeIPv4(ftp: FTPContext): Promise<FTPResponse>;
  18. /**
  19. * Parse a PASV response.
  20. */
  21. export declare function parsePasvResponse(message: string): {
  22. host: string;
  23. port: number;
  24. };
  25. export declare function connectForPassiveTransfer(host: string, port: number, ftp: FTPContext): Promise<void>;
  26. export interface TransferConfig {
  27. command: string;
  28. remotePath: string;
  29. type: ProgressType;
  30. ftp: FTPContext;
  31. tracker: ProgressTracker;
  32. }
  33. export declare function uploadFrom(source: Readable, config: TransferConfig): Promise<FTPResponse>;
  34. export declare function downloadTo(destination: Writable, config: TransferConfig): Promise<FTPResponse>;