Skip to main content
Module

x/ftpc/mod.ts>FTPClient

FTP Client for Deno
Go to Latest
class FTPClient
implements [Deno.Closer]
import { FTPClient } from "https://deno.land/x/ftpc@v2.0.0/mod.ts";

Constructors

new
FTPClient(host: string, opts?: ConnectionOptions)

Properties

private
optional
activeListener: Deno.Listener
private
optional
conn: Deno.Conn
private
optional
dataConn: Deno.Conn
private
decode: TextDecoder
private
encode: TextEncoder
private
feats: FeatMatrix
private
lock: Lock
private
opts: IntConnOpts

Methods

private
assertStatus(
expected: StatusCodes,
result: { code: number; message: string; },
...resources: (Deno.Closer | undefined)[],
)
private
command(c: Commands, args?: string)
private
commandWithData(c: Commands, args?: string)
private
getStatus()
private
parseMDTM(date: string): Date
private
parseMLST(input: string): [string, FTPFileInfo]

Like cd ..

chdir(path: string)

cd like command

Please call this function when you are done to avoid loose connections.

Initialize connection to server.

cwd()

Current Working Directory pwd

download(fileName: string)

Download a file from the server.

downloadStream(fileName: string): Promise<Deno.Reader>

Download a file from the server with streaming. Please call FTPClient.finalizeStream() to release the lock after the file is done downloading.

extendedList(dirName?: string)

Unlock and close connections for streaming.

list(dirName?: string)

Retrieve a directory listing from the server.

mkdir(dirName: string)

Create a directory on the server.

modified(filename: string): Promise<Date>

Get file modification time.

rename(from: string, to: string)

Rename a file on the server.

rm(fileName: string)

Remove a file on the server.

rmdir(dirName: string)

Remove a directory on the server.

size(filename: string): Promise<number>

Get file size in bytes

stat(filename: string): Promise<FTPFileInfo>

Obtain file information from the FTP server.

upload(fileName: string, data: Uint8Array)

Upload a file to the server.

uploadStream(fileName: string, allocate?: number)

Upload a file to the server, with streaming. Please call FTPClient.finalizeStream() to release the lock after the file is done downloading.**