Class SFTPFileInfo

The class is used to store information about a remote file.

Note: when this class is used with sensitive data, be careful in persisting sensitive information to disk.

Property Summary 

PropertyDescription
directory: Boolean (read-only)Identifies if the file is a directory.
modificationTime: Date (read-only)Returns the last modification time of the file/directory.
name: String (read-only)Returns the name of the file/directory.
size: Number (read-only)Returns the size of the file/directory.

Constructor Summary 

ConstructorDescription
SFTPFileInfo(String, Number, Boolean, Number)Constructs the SFTPFileInfo instance.

Method Summary 

MethodDescription
getDirectory()Identifies if the file is a directory.
getModificationTime()Returns the last modification time of the file/directory.
getName()Returns the name of the file/directory.
getSize()Returns the size of the file/directory.

Methods inherited from class Object 

assign, create, create, defineProperties, defineProperty, entries, freeze, fromEntries, getOwnPropertyDescriptor, getOwnPropertyNames, getOwnPropertySymbols, getPrototypeOf, hasOwnProperty, is, isExtensible, isFrozen, isPrototypeOf, isSealed, keys, preventExtensions, propertyIsEnumerable, seal, setPrototypeOf, toLocaleString, toString, valueOf, values

Property Details 

directory 

directory: Boolean (read-only)

Identifies if the file is a directory.


modificationTime 

modificationTime: Date (read-only)

Returns the last modification time of the file/directory.


name 

name: String (read-only)

Returns the name of the file/directory.


size 

size: Number (read-only)

Returns the size of the file/directory.


Constructor Details 

SFTPFileInfo(String, Number, Boolean, Number) 

SFTPFileInfo(name: String, size: Number, directory: Boolean, mtime: Number)

Constructs the SFTPFileInfo instance.

Parameters:

  • name - the name of the file.
  • size - the size of the file.
  • directory - controls if the file is a directory.
  • mtime - last modification time.

Method Details 

getDirectory() 

getDirectory(): Boolean

Identifies if the file is a directory.

Returns:

  • true if the file is a directory, false otherwise.

getModificationTime() 

getModificationTime(): Date

Returns the last modification time of the file/directory.

Returns:

  • the last modification time.

getName() 

getName(): String

Returns the name of the file/directory.

Returns:

  • the name.

getSize() 

getSize(): Number

Returns the size of the file/directory.

Returns:

  • the size.