Object - internal : Path

Reference to the file location.

getPathValue

()

returns string

Retreives the absolute path from the provided location.

  • Return Type

    (string)
  • Returns the absolute path as a string

getName

()

returns string

Retreives the name of the file from the provided location.

  • Return Type

    (string)
  • Returns the name of the file

getExtension

()

returns string

Retreives the extension of the file from the provided location.

  • Return Type

    (string)
  • Returns the extension of the file. Empty string if no extension.

exists

()

returns boolean

Check for existance of the file.

  • Return Type

    (boolean)
  • True if the file exists, else false

list

()

returns Path[] | error

Returns the files of folders in the directory.

  • Return Type

    (Path[] | error)
  • True if the given file path is a directory. It is false otherwise

isDirectory

()

returns boolean

Check if given file is a directory

  • Return Type

    (boolean)
  • True if directory, else false

delete

()

returns error?

Deletes a file/directory.

  • Return Type

    (error?)
  • Error if the directory/file could not be deleted

createDirectory

()

returns error?

Creates a directory.

  • Return Type

    (error?)
  • Error if the directory could not be created

createFile

()

returns error?

Creates a file.

  • Return Type

    (error?)
  • Error if the file could not be created

getModifiedTime

()

returns Time | error

Retrieves the last modified time of the file of directory.

  • Return Type

    (Time | error)
  • Last modified time or an error if the path cannot be resolved

copyTo

(Path target)

returns error?

Copy file or directory to another path.

Parameters

  • target Path
  • The location to copy file or directory

  • Return Type

    (error?)
  • Error if the file could not be copied

moveTo

(Path target)

returns error?

Move file or directory to another path.

Parameters

  • target Path
  • The location to move file or directory

  • Return Type

    (error?)
  • Error if the file could not be moved

getParentDirectory

()

returns Path | error

Get the enclosing parent directory.

  • Return Type

    (Path | error)
  • Path of parent folder or error occurred while getting parent directory

resolve

(string[] paths)

returns Path

Resolve given path.

Parameters

  • paths string[]
  • Paths to be resolved within the current path

  • Return Type

    (Path)
  • Resolved path