Skip to content

DocumentFile

The DocumentFile class represents a file or folder in a document management system. It provides methods and properties for managing file metadata, versions, and file operations such as signing, deleting, or retrieving files.

  • constructor(filePath: string)
    Initializes a new DocumentFile object with the specified file path.
  • filePath: The full path of the document file.

Properties:

  • id: string (read-only)
    The unique identifier of the file.
  • archiveId: string (read-only)
    Archive ID of this file.
  • name: string
    The full name of the file, including its extension.
  • shortName: string
    A name of the file within its folder.
  • ext: string
    The file extension (e.g., .txt, .pdf).
  • nameWithoutExtension: string (read-only)
    The full file name without the extension.
  • shortNameWithoutExtension: string (read-only)
    The short file name without the extension.
  • hash: string (read-only)
    The cryptographic hash of the file, used for file integrity.
  • lastSignedHash: string (read-only)
    The hash of the last signed version of the file.
  • path: string (read-only)
    The full file path of the retrieved file in the client file system.
  • icon: string (read-only)
    The icon associated with the file.
  • versionMajor: number (read-only)
    The major version number of the file.
  • versionMinor: number (read-only)
    The minor version number of the file.
  • versionBuild: number (read-only)
    The build version number of the file.
  • isFolder: boolean (read-only)
    Whether the file is a folder.
  • isLink: boolean (read-only)
    Whether the file is a link.
  • isReadOnly: boolean (read-only)
    Whether the file is read-only.
  • isCheckedOut: boolean (read-only)
    Whether the file is currently checked out.
  • isCheckedOutByMe: boolean (read-only)
    Whether the file is checked out by the current user.
  • isCheckedOutNOTByMe: boolean (read-only)
    Whether the file is checked out by someone other than the current user.
  • isNew: boolean (read-only)
    Whether the file is new.
  • isModified: boolean (read-only)
    Whether the file has been modified.
  • isModifiedLocally: boolean
    Whether the file is modified locally, regardless of its checkout status.
  • isChanged: boolean (read-only)
    Whether the file is new or modified.
  • isChangedLocally: boolean (read-only)
    Whether the file is new or modified locally.
  • isSigned: boolean (read-only)
    Whether the file is signed.
  • isCompressed: boolean
    Whether the file is compressed.
  • isEncrypted: boolean
    Whether the file is encrypted.
  • isLatestVersion: boolean
    Whether the file is the latest version.
  • size: number (read-only)
    The size of the file in bytes.
  • lastWriteTime: Date (read-only)
    The last modification time of the file.
  • signTime: Date (read-only)
    The last time the file was signed.
  • canSign: boolean (read-only)
    Whether the file can be signed by the current user.
  • files: DocumentFiles (read-only)
    If a file object isFolder then files collection represents its contained files.
  • document: Record (read-only)
    The document this file belongs to.
  • container: any (read-only)
    The parent folder or the file itself.
  • versions: DocumentFiles (read-only)
    A collection of previous versions of the file.
  • commands: Command[] (read-only)
    A list of available file commands. These commands can be defined in data class script with property get fileCommands(): Command[].
    This property is the same as record.fileCommands.

Methods:

  • delete()
    Deletes the document file.
  • retrieve()
    Retrieves the document file from the archive.
  • replace(filePath: string)
    Replaces the current document file with the file at the given path.
  • filePath: The path to the file that will replace the current one.
  • sign(certificate: any)
    Signs the document file using the specified certificate.
  • certificate: The certificate used for signing the file.
  • convert(toFormat: string, outputPath: string)
    Converts the document file to a different format and saves it at the specified output path. Of course, converters for specified in/out formats must exist.
  • toFormat: The format to which the file should be converted (e.g., PDF).
  • outputPath: The path where the converted file will be saved.
  • revertoToThis()
    Reverts the document to this version.

Static Properties:

  • folderSeparator: string (read-only)
    The folder separator character (/) used in file paths.