Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace File

Offers various file system operations.

since

1.8

Index

Variables

Const AccessMask

AccessMask: 1008

Const AllDirs

AllDirs: 1024

Const AllEntries

AllEntries: 7

Const CaseSensitive

CaseSensitive: 2048

Const Dirs

Dirs: 1

Const DirsFirst

DirsFirst: 4

Const DirsLast

DirsLast: 32

Const Drives

Drives: 4

Const Executable

Executable: 64

Const Files

Files: 2

Const Hidden

Hidden: 256

Const IgnoreCase

IgnoreCase: 16

Const LocaleAware

LocaleAware: 64

Const Modified

Modified: 128

Const Name

Name: 0

Const NoDot

NoDot: 8192

Const NoDotAndDotDot

NoDotAndDotDot: 24576

Const NoDotDot

NoDotDot: 16384

Const NoFilter

NoFilter: -1

Const NoSort

NoSort: -1

Const NoSymLinks

NoSymLinks: 8

Const PermissionMask

PermissionMask: 112

Const Readable

Readable: 16

Const Reversed

Reversed: 8

Const Size

Size: 2

Const SortByMask

SortByMask: 3

Const System

System: 512

Const Time

Time: 1

Const Type

Type: 128

Const TypeMask

TypeMask: 15

Const Unsorted

Unsorted: 3

Const Writable

Writable: 32

Functions

copy

  • copy(sourceFilePath: string, targetFilePath: string): boolean
  • Copies sourceFilePath to targetFilePath. Any directory components in targetFilePath that do not yet exist will be created. If sourceFilePath is a directory, a recursive copy will be made. If an error occurs, a JavaScript exception will be thrown.

    note

    targetFilePath must be the counterpart of sourceFilePath at the new location, not the new parent directory. This allows the copy to have a different name and is true even if sourceFilePath is a directory.

    note

    The file is not copied if the source file timestamp is older than the destination file timestamp. If you want to replace the newer file, you need to remove it first via File.remove.

directoryEntries

  • directoryEntries(path: string, filters?: number, sortFlags?: number): string[]
  • Returns a list of the directory path's contents non-recursively, filtered by the given filters and sorted by the given sortFlags (defaults to sorting by name).

    The values for filters are equivalent to Qt's QDir::Filter. The sortFlags are equivalent to QDir::SortFlags.

exists

  • exists(filePath: string): boolean
  • Returns true if and only if there is a file at filePath.

lastModified

  • lastModified(filePath: string): Date
  • Returns the time of last modification for the file at filePath. The concrete semantics of the returned value are platform-specific. You should only rely on the property that a smaller value indicates an older timestamp.

makePath

  • makePath(path: string): boolean
  • Makes the directory at path, creating intermediate directories if necessary. Conceptually equivalent to mkdir -p.

move

  • move(sourceFile: string, targetFile: string, overwrite?: boolean): boolean
  • Renames the file sourceFile to targetFile. Returns true if successful; otherwise returns false.

    The overwrite parameter is true by default.

    If a file with the name targetFile already exists, and overwrite is false, move() returns false (that is, the file will not be overwritten).

remove

  • remove(filePath: string): boolean
  • Removes the file at filePath. In case of a directory, it will be removed recursively.

Generated using TypeDoc