Class: IO

DKTools.IO

File system class

new DKTools.IO ()

Classes

Directory
Entity
File
WebStorage

Members

DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE Number staticconstant

The callback function is not available for an asynchronous operation

DKTools.IO.ERROR_DECOMPRESSING_DATA Number staticconstant

Failed decompressing data
Since:
  • 7.0.0

DKTools.IO.ERROR_DIRECTORY_ALREADY_EXISTS Number staticconstant

Directory already exists

DKTools.IO.ERROR_DIRECTORY_IS_NOT_EMPTY Number staticconstant

Directory is not empty

DKTools.IO.ERROR_NOT_LOCAL_MODE Number staticconstant

Platform is not equal to NW.js

DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE Number staticconstant

The options are not available for an operation
Since:
  • 7.0.0

DKTools.IO.ERROR_OVERWRITING_IS_NOT_AVAILABLE Number staticconstant

Overwriting is not available
Since:
  • 7.0.0

DKTools.IO.ERROR_PARSING_DATA Number staticconstant

Failed parsing data
Since:
  • 7.0.0

DKTools.IO.ERROR_PATH_DOES_NOT_EXIST Number staticconstant

Path does not exist

DKTools.IO.EXPECT_CALLBACK Number staticconstant

Expect until an asynchronous operation calls the callback function
Since:
  • 7.0.0

DKTools.IO.fs Object staticreadonly

File system

DKTools.IO.mode Number staticreadonly

File system mode
Since:
  • 8.0.0

DKTools.IO.MODE_NWJS Number staticconstant

Nwjs file system mode
Since:
  • 8.0.0

DKTools.IO.MODE_NWJS_STAMP Number staticconstant

Nwjs + Stamp file system mode
Since:
  • 8.0.0

DKTools.IO.OK Number staticconstant

Operation completed successfully

DKTools.IO.os Object staticreadonly

OS

DKTools.IO.path Object staticreadonly

Path

DKTools.IO.projectPath String staticreadonly

Path to the project folder

DKTools.IO.sep String staticreadonly

Provides the platform-specific path segment separator For mobile phones and browsers always return '/'
Since:
  • 7.0.0

DKTools.IO.stamp Object staticreadonly

File system stamp
Since:
  • 8.0.0

_mode Number privatereadonly

Since:
  • 8.0.0

_projectPath String privatereadonly

_stamp Object privatereadonly

Since:
  • 8.0.0

Methods

DKTools.IO._createStamp () asyncprivatestatic

Creates the file system stamp
Version:
  • 10.0.0
Since:
  • 8.0.0

DKTools.IO._loadStamp () privatestatic

Loads the file system stamp
Since:
  • 8.0.0

DKTools.IO._splitPath (path)Array.<String> privatestatic

Splits the path
Name Type Description
path String Path
Since:
  • 5.0.0
Returns:
Type Description
Array.<String> Splitted path

DKTools.IO._statPath (path)Object privatestatic

Returns the stats of the path
Name Type Description
path String Path
Since:
  • 5.0.0
Returns:
Type Description
Object

DKTools.IO.absolutePathExists (path)Boolean static

Returns true if the absolute path exists
Name Type Description
path String Path
Version:
  • 8.0.0
Since:
  • 3.0.0
Returns:
Type Description
Boolean Absolute path exists

DKTools.IO.getAbsolutePath (path)String static

Returns the absolute path to file or directory
Name Type Description
path String Path
Since:
  • 3.0.0
Returns:
Type Description
String Absolute path to file or directory

DKTools.IO.getRootDirectory ()DKTools.IO.Directory static

Returns the project directory
Since:
  • 4.0.0
Returns:
Type Description
DKTools.IO.Directory Project directory

DKTools.IO.initialize () static

Version:
  • 10.0.5

DKTools.IO.isDirectory (fullPath)Boolean static

Returns true if the full path is a directory
Name Type Description
fullPath String Path to directory
Version:
  • 8.0.0
Returns:
Type Description
Boolean Full path is a directory

DKTools.IO.isFile (fullPath)Boolean static

Returns true if the full path is a file
Name Type Description
fullPath String Path to file
Version:
  • 8.0.0
Returns:
Type Description
Boolean Full path is a file

DKTools.IO.joinPath (paths)String static

Joins all given path segments together using the platform specific separator as a delimiter, then normalizes the resulting path.
Name Type Description
paths String repeatable Path segments
Since:
  • 5.0.0
Returns:
Type Description
String

DKTools.IO.normalizePath (path, reverseSlash)String static

Returns a normalized path
Name Type Default Description
path String Path for normalize
reverseSlash Boolean false optional Reversing slash
Version:
  • 6.1.0
Returns:
Type Description
String Normalized path

DKTools.IO.parsePath (path)Object static

Returns an object whose properties represent significant elements of the path. Trailing directory separators are ignored.
Name Type Description
path String Path
Since:
  • 5.0.0
Returns:
Type Description
Object

DKTools.IO.pathExists (path)Boolean static

Returns true if the path exists
Name Type Description
path String Path
Version:
  • 3.0.0
Returns:
Type Description
Boolean Path exists
Example
DKTools.IO.pathExists('img/system/'); // => true

DKTools.IO.reverseSlashes (path)String static

Reverses slashes on "/"
Name Type Description
path String Path
Since:
  • 9.0.0
Returns:
Type Description
String Path with reversed slashes "/"