Skip to main content
Module

x/ftpc/mod.ts>FTPClient

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

Constructors

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

Properties

private
optional
activeListener: Deno.Listener
private
optional
conn: Deno.Conn
private
optional
connLineReader: ReadableStream<string>
private
optional
dataConn: Deno.Conn
private
encode: TextEncoder
private
feats: FeatMatrix
private
lock: Lock
private
opts: IntConnOpts

Methods

private
assertStatus(
expected: StatusCodes,
result: FTPReply,
...resources: (Deno.Closer | undefined)[],
)
private
command(c: Commands, args?: string)
private
commandWithData(c: Commands, args?: string)
private
epasvStart(res: FTPReply)
private
getStatus(): Promise<FTPReply>
private
parseMDTM(date: string): Date
private
parseMLST(input: string): [string, FTPFileInfo]
private
pasvStart(res: FTPReply)

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.

downloadReadable(fileName: string): Promise<ReadableStream>

Download a file from the server using a ReadableStream interface. Please call FTPClient.finalizeStream to release the lock after the file is downloaded.

deprecated
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.

deprecated
uploadStream(fileName: string, allocate?: number): Promise<Deno.Writer>

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

uploadWritable(fileName: string, allocate?: number): Promise<WritableStream>

Upload a file using a WritableStream interface. Please call FTPClient.finalizeStream() to release the lock after the file is uploaded.