Class: Directory

DKTools.IO.Directory

Directory class

new DKTools.IO.Directory ()

Extends

Members

_extension String privatereadonly inherited

_initialExtension String privatereadonly inherited

_name String privatereadonly inherited

_path String privatereadonly inherited

extension inherited

Gets extension of the entity
Since:
  • 3.0.0

initialExtension inherited

Gets initial extension of the entity
Since:
  • 5.0.0

name inherited

Gets name of the entity

path inherited

Gets path of the entity
Since:
  • 3.0.0

Methods

__processError (error, onError) private inherited

Name Type Description
error * Error
onError function optional Callback function upon completion of an operation with error
Since:
  • 6.1.0

create (object)Number

Creates the directory Returns a code of the result of an operation Possible results: DKTools.IO.OK DKTools.IO.EXPECT_CALLBACK DKTools.IO.ERROR_NOT_LOCAL_MODE DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE DKTools.IO.ERROR_DIRECTORY_ALREADY_EXISTS
Name Type Description
object Object Options of an operation
Name Type Description
sync Boolean optional Use synchronous version of FileSystem.mkdir
options Object optional Options for FileSystem.mkdir or FileSystem.mkdirSync
onSuccess function optional Callback function upon completion of an operation (only for object.sync == false)
onError function optional Callback function upon completion of an operation with error (only for object.sync == false)
options.recursive Boolean optional Parent folders should be created
options.mode Number | String optional Directory permission
Version:
  • 10.0.0
Returns:
Type Description
Number Code of the result of an operation
Example
const directory = new DKTools.IO.Directory('test/');
const status = directory.create({ sync: true });

if (status === DKTools.IO.OK) {
     console.log('created!');
}

createAsync (object)Promise.<Number> async

Creates the directory Asynchronous version of DKTools.IO.Directory.prototype.create Promise resolves a code of the result of an operation Possible results: DKTools.IO.OK DKTools.IO.ERROR_NOT_LOCAL_MODE DKTools.IO.ERROR_DIRECTORY_ALREADY_EXISTS
Name Type Default Description
object Object {} optional Options of an operation
Name Type Description
options String | Object optional Options for FileSystem.mkdir or FileSystem.mkdirSync
Name Type Description
recursive Boolean optional Parent folders should be created
mode Number | String optional Directory permission
Version:
  • 7.0.0
Since:
  • 4.0.0
Returns:
Type Description
Promise.<Number> Code of the result of an operation
Example
const directory = new DKTools.IO.Directory('test/');
const status = await directory.createAsync();

if (status === DKTools.IO.OK) {
     console.log('created!');
}

createDirectory (name, object)Number

Creates the new directory Returns a code of the result of an operation Possible results: DKTools.IO.OK DKTools.IO.ERROR_NOT_LOCAL_MODE DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE DKTools.IO.ERROR_DIRECTORY_ALREADY_EXISTS
Name Type Description
name String Name of the directory
object Object Options of an operation
Name Type Description
sync Boolean optional Use synchronous version of FileSystem.mkdir
options Object optional Options for FileSystem.mkdir or FileSystem.mkdirSync
onSuccess function optional Callback function upon completion of an operation (only for object.sync == false)
onError function optional Callback function upon completion of an operation with error (only for object.sync == false)
options.recursive Boolean optional Parent folders should be created
options.mode Number | String optional Directory permission
Version:
  • 7.0.0
Since:
  • 6.3.0
Returns:
Type Description
Number Code of the result of an operation
Example
const directory = new DKTools.IO.Directory('save/');
const status = directory.createDirectory('backup', { sync: true });

if (status === DKTools.IO.OK) {
     console.log('created!');
}

createDirectoryAsync (name, object)Promise.<Number> async

Creates the new directory Asynchronous version of DKTools.IO.Directory.prototype.createDirectory Promise resolves a code of the result of an operation Possible results: DKTools.IO.OK DKTools.IO.ERROR_NOT_LOCAL_MODE DKTools.IO.ERROR_DIRECTORY_ALREADY_EXISTS
Name Type Default Description
name String Name of the directory
object Object {} optional Options of an operation
Name Type Description
options String | Object optional Options for FileSystem.mkdir or FileSystem.mkdirSync
Name Type Description
recursive Boolean optional Parent folders should be created
mode Number | String optional Directory permission
Version:
  • 7.0.0
Since:
  • 6.3.0
Returns:
Type Description
Promise.<Number> Code of the result of an operation
Example
const directory = new DKTools.IO.Directory('save/');
const status = await directory.createDirectoryAsync('backup');

if (status === DKTools.IO.OK) {
     console.log('created!');
}

equals (entity)Boolean inherited

Returns true is the entity is same
Name Type Description
entity DKTools.IO.Entity Entity
Since:
  • 11.2.1
Returns:
Type Description
Boolean Entity is same

exists ()Boolean inherited

Returns true if the entity exists
Version:
  • 3.0.0
Returns:
Type Description
Boolean Entity exists

findDirectories (object)Object

Finds the directories Returns an object with 2 properties: status - Result of an operation data - Array with directories if the status is not equal to DKTools.IO.OK then data will be null Possible statuses: DKTools.IO.OK DKTools.IO.EXPECT_CALLBACK DKTools.IO.ERROR_NOT_LOCAL_MODE DKTools.IO.ERROR_PATH_DOES_NOT_EXIST DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE
Name Type Description
object Object Options of an operation
Name Type Description
sync Boolean optional Use synchronous version of FileSystem.readdir
options String | Object optional Options for FileSystem.readdir or FileSystem.readdirSync
template RegExp | String optional Template for filtering
onSuccess function optional Callback function upon completion of an operation (only for object.sync == false)
onError function optional Callback function upon completion of an operation with error (only for object.sync == false)
searchLimit Number optional Search limit
Version:
  • 10.0.0
Since:
  • 4.0.0
Returns:
Type Description
Object All directories
Example
const directory = new DKTools.IO.Directory('img/');
const result = directory.findDirectories({ sync: true, template: 'system' });

if (result.status === DKTools.IO.OK) {
    console.log(result.data);
}

findDirectoriesAsync (object)Promise.<{status: Number, data: (Array.<DKTools.IO.Directory>|null)}> async

Finds the directories Asynchronous version of DKTools.IO.Directory.prototype.findDirectories Promise resolves an object with 2 properties: status - Result of an operation data - Array with directories if the status is not equal to DKTools.IO.OK then data will be null Possible statuses: DKTools.IO.OK DKTools.IO.ERROR_NOT_LOCAL_MODE DKTools.IO.ERROR_PATH_DOES_NOT_EXIST
Name Type Default Description
object Object {} optional Options of an operation
Name Type Description
options String | Object optional Options for FileSystem.readdir
template RegExp | String optional Template for filtering
searchLimit Number optional Search limit
Version:
  • 6.1.0
Since:
  • 4.0.0
Returns:
Type Description
Promise.<{status: Number, data: (Array.<DKTools.IO.Directory>|null)}> All directories

findFiles (object)Object

Finds the files Returns an object with 2 properties: status - Result of an operation data - Array with files if the status is not equal to DKTools.IO.OK then data will be null Possible statuses: DKTools.IO.OK DKTools.IO.EXPECT_CALLBACK DKTools.IO.ERROR_NOT_LOCAL_MODE DKTools.IO.ERROR_PATH_DOES_NOT_EXIST DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE
Name Type Description
object Object Options of an operation
Name Type Description
sync Boolean optional Use synchronous version of FileSystem.readdir
options String | Object optional Options for FileSystem.readdir or FileSystem.readdirSync
template RegExp | String optional Template for filtering
onSuccess function optional Callback function upon completion of an operation (only for object.sync == false)
onError function optional Callback function upon completion of an operation with error (only for object.sync == false)
searchLimit Number optional Search limit
Version:
  • 11.2.1
Since:
  • 4.0.0
Returns:
Type Description
Object All files
Example
const directory = new DKTools.IO.Directory('img/');
const result = directory.findFiles({ sync: true, template: 'Window.png' });

if (result.status === DKTools.IO.OK) {
    console.log(result.data);
}

findFilesAsync (object)Promise.<{status: Number, data: (Array.<DKTools.IO.File>|null)}> async

Finds the files Asynchronous version of DKTools.IO.Directory.prototype.findFiles Promise resolves an object with 2 properties: status - Result of an operation data - Array with files if the status is not equal to DKTools.IO.OK then data will be null Possible statuses: DKTools.IO.OK DKTools.IO.ERROR_NOT_LOCAL_MODE DKTools.IO.ERROR_PATH_DOES_NOT_EXIST
Name Type Default Description
object Object {} optional Options of an operation
Name Type Description
options String | Object optional Options for FileSystem.readdir
template RegExp | String optional Template for filtering
searchLimit Number optional Search limit
Version:
  • 6.1.0
Since:
  • 4.0.0
Returns:
Type Description
Promise.<{status: Number, data: (Array.<DKTools.IO.File>|null)}> All files

getAbsolutePath ()String inherited

Returns the absolute path
Since:
  • 3.0.0
Returns:
Type Description
String Absolute path

getAll (object)Object

Returns all files and directories Returns an object with 2 properties: status - Result of an operation data - Array with files and directories if the status is not equal to DKTools.IO.OK then data will be null Possible statuses: DKTools.IO.OK DKTools.IO.EXPECT_CALLBACK DKTools.IO.ERROR_NOT_LOCAL_MODE DKTools.IO.ERROR_PATH_DOES_NOT_EXIST DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE
Name Type Description
object Object Options of an operation
Name Type Description
sync Boolean optional Use synchronous version of FileSystem.readdir
options String | Object optional Options for FileSystem.readdir or FileSystem.readdirSync
template RegExp | String optional Template for filtering
onSuccess function optional Callback function upon completion of an operation (only for object.sync == false)
onError function optional Callback function upon completion of an operation with error (only for object.sync == false)
Version:
  • 11.1.0
Returns:
Type Description
Object All files and directories

getAllAsync (object)Promise.<{status: Number, data: (Array.<DKTools.IO.Entity>|null)}> async

Returns all files and directories Asynchronous version of DKTools.IO.Directory.prototype.getAll Promise resolves an object with 2 properties: status - Result of an operation data - Array with files and directories if the status is not equal to DKTools.IO.OK then data will be null Possible statuses: DKTools.IO.OK DKTools.IO.ERROR_NOT_LOCAL_MODE DKTools.IO.ERROR_PATH_DOES_NOT_EXIST
Name Type Default Description
object Object {} optional Options of an operation
Name Type Description
options String | Object optional Options for FileSystem.readdir
template RegExp | String optional Template for filtering
Version:
  • 6.1.0
Since:
  • 4.0.0
Returns:
Type Description
Promise.<{status: Number, data: (Array.<DKTools.IO.Entity>|null)}> All files and directories

getAudioFiles (object)Object

Returns all audio files Returns an object with 2 properties: status - Result of an operation data - Array with files if the status is not equal to DKTools.IO.OK then data will be null Possible statuses: DKTools.IO.OK DKTools.IO.EXPECT_CALLBACK DKTools.IO.ERROR_NOT_LOCAL_MODE DKTools.IO.ERROR_PATH_DOES_NOT_EXIST DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE
Name Type Description
object Object Options of an operation
Name Type Description
sync Boolean optional Use synchronous version of FileSystem.readdir
options String | Object optional Options for FileSystem.readdir or FileSystem.readdirSync
onSuccess function optional Callback function upon completion of an operation (only for object.sync == false)
onError function optional Callback function upon completion of an operation with error (only for object.sync == false)
Version:
  • 7.0.0
Since:
  • 3.0.0
Returns:
Type Description
Object All audio files

getAudioFilesAsync (object)Promise.<{status: Number, data: (Array.<DKTools.IO.File>|null)}> async

Returns all audio files Asynchronous version of DKTools.IO.Directory.prototype.getAudioFiles Promise resolves an object with 2 properties: status - Result of an operation data - Array with files if the status is not equal to DKTools.IO.OK then data will be null Possible statuses: DKTools.IO.OK DKTools.IO.ERROR_NOT_LOCAL_MODE DKTools.IO.ERROR_PATH_DOES_NOT_EXIST
Name Type Default Description
object Object {} optional Options of an operation
Name Type Description
options String | Object optional Options for FileSystem.readdir
Version:
  • 6.1.0
Since:
  • 4.0.0
Returns:
Type Description
Promise.<{status: Number, data: (Array.<DKTools.IO.File>|null)}> All audio files

getDirectories (object)Object

Returns all directories Returns an object with 2 properties: status - Result of an operation data - Array with directories if the status is not equal to DKTools.IO.OK then data will be null Possible statuses: DKTools.IO.OK DKTools.IO.EXPECT_CALLBACK DKTools.IO.ERROR_NOT_LOCAL_MODE DKTools.IO.ERROR_PATH_DOES_NOT_EXIST DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE
Name Type Description
object Object Options of an operation
Name Type Description
sync Boolean optional Use synchronous version of FileSystem.readdir
options String | Object optional Options for FileSystem.readdir or FileSystem.readdirSync
template RegExp optional Template for filtering
onSuccess function optional Callback function upon completion of an operation (only for object.sync == false)
onError function optional Callback function upon completion of an operation with error (only for object.sync == false)
Version:
  • 7.0.0
Returns:
Type Description
Object All directories

getDirectoriesAsync (object)Promise.<{status: Number, data: (Array.<DKTools.IO.Directory>|null)}> async

Returns all directories Asynchronous version of DKTools.IO.Directory.prototype.getDirectories Promise resolves an object with 2 properties: status - Result of an operation data - Array with directories if the status is not equal to DKTools.IO.OK then data will be null Possible statuses: DKTools.IO.OK DKTools.IO.ERROR_NOT_LOCAL_MODE DKTools.IO.ERROR_PATH_DOES_NOT_EXIST
Name Type Default Description
object Object {} optional Options of an operation
Name Type Description
options String | Object optional Options for FileSystem.readdir
template RegExp | String optional Template for filtering
Version:
  • 6.1.0
Since:
  • 4.0.0
Returns:
Type Description
Promise.<{status: Number, data: (Array.<DKTools.IO.Directory>|null)}> All directories

getExtension ()String inherited

Returns the extension of the entity
Since:
  • 3.0.0
Returns:
Type Description
String Extension of the entity

getFiles (object)Object

Returns all files Returns an object with 2 properties: status - Result of an operation data - Array with files if the status is not equal to DKTools.IO.OK then data will be null Possible statuses: DKTools.IO.OK DKTools.IO.EXPECT_CALLBACK DKTools.IO.ERROR_NOT_LOCAL_MODE DKTools.IO.ERROR_PATH_DOES_NOT_EXIST DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE
Name Type Description
object Object Options of an operation
Name Type Description
sync Boolean optional Use synchronous version of FileSystem.readdir
options String | Object optional Options for FileSystem.readdir or FileSystem.readdirSync
template RegExp optional Template for filtering
onSuccess function optional Callback function upon completion of an operation (only for object.sync == false)
onError function optional Callback function upon completion of an operation with error (only for object.sync == false)
Version:
  • 7.0.0
Returns:
Type Description
Object All files

getFilesAsync (object)Promise.<{status: Number, data: (Array.<DKTools.IO.File>|null)}> async

Returns all files Asynchronous version of DKTools.IO.Directory.prototype.getFiles Promise resolves an object with 2 properties: status - Result of an operation data - Array with files if the status is not equal to DKTools.IO.OK then data will be null Possible statuses: DKTools.IO.OK DKTools.IO.ERROR_NOT_LOCAL_MODE DKTools.IO.ERROR_PATH_DOES_NOT_EXIST
Name Type Default Description
object Object {} optional Options of an operation
Name Type Description
options String | Object optional Options for FileSystem.readdir
template RegExp | String optional Template for filtering
Version:
  • 6.1.0
Since:
  • 4.0.0
Returns:
Type Description
Promise.<{status: Number, data: (Array.<DKTools.IO.File>|null)}> All files

getFullName ()String inherited

Returns the full name
Version:
  • 10.0.8
Since:
  • 3.0.0
Returns:
Type Description
String Full name

getFullPath ()String inherited

Returns the full path
Version:
  • 3.0.0
Returns:
Type Description
String Full Path

getImageFiles (object)Object

Returns all image files Returns an object with 2 properties: status - Result of an operation data - Array with files if the status is not equal to DKTools.IO.OK then data will be null Possible statuses: DKTools.IO.OK DKTools.IO.EXPECT_CALLBACK DKTools.IO.ERROR_NOT_LOCAL_MODE DKTools.IO.ERROR_PATH_DOES_NOT_EXIST DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE
Name Type Description
object Object Options of an operation
Name Type Description
sync Boolean optional Use synchronous version of FileSystem.readdir
options String | Object optional Options for FileSystem.readdir or FileSystem.readdirSync
onSuccess function optional Callback function upon completion of an operation (only for object.sync == false)
onError function optional Callback function upon completion of an operation with error (only for object.sync == false)
Version:
  • 7.0.0
Since:
  • 3.0.0
Returns:
Type Description
Object All image files

getImageFilesAsync (object)Promise.<{status: Number, data: (Array.<DKTools.IO.File>|null)}> async

Returns all image files Asynchronous version of DKTools.IO.Directory.prototype.getImageFiles Promise resolves an object with 2 properties: status - Result of an operation data - Array with files if the status is not equal to DKTools.IO.OK then data will be null Possible statuses: DKTools.IO.OK DKTools.IO.ERROR_NOT_LOCAL_MODE DKTools.IO.ERROR_PATH_DOES_NOT_EXIST
Name Type Default Description
object Object {} optional Options of an operation
Name Type Description
options String | Object optional Options for FileSystem.readdir
Since:
  • 4.0.0
Returns:
Type Description
Promise.<{status: Number, data: (Array.<DKTools.IO.File>|null)}> All image files

getJsonFiles (object)Object

Returns all JSON files Returns an object with 2 properties: status - Result of an operation data - Array with files if the status is not equal to DKTools.IO.OK then data will be null Possible statuses: DKTools.IO.OK DKTools.IO.EXPECT_CALLBACK DKTools.IO.ERROR_NOT_LOCAL_MODE DKTools.IO.ERROR_PATH_DOES_NOT_EXIST DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE
Name Type Description
object Object Options of an operation
Name Type Description
sync Boolean optional Use synchronous version of FileSystem.readdir
options String | Object optional Options for FileSystem.readdir or FileSystem.readdirSync
onSuccess function optional Callback function upon completion of an operation (only for object.sync == false)
onError function optional Callback function upon completion of an operation with error (only for object.sync == false)
Version:
  • 7.0.0
Since:
  • 3.0.0
Returns:
Type Description
Object All JSON files

getJsonFilesAsync (object)Promise.<{status: Number, data: (Array.<DKTools.IO.File>|null)}> async

Returns all JSON files Asynchronous version of DKTools.IO.Directory.prototype.getJsonFiles Promise resolves an object with 2 properties: status - Result of an operation data - Array with files if the status is not equal to DKTools.IO.OK then data will be null Possible statuses: DKTools.IO.OK DKTools.IO.ERROR_NOT_LOCAL_MODE DKTools.IO.ERROR_PATH_DOES_NOT_EXIST
Name Type Default Description
object Object {} optional Options of an operation
Name Type Description
options String | Object optional Options for FileSystem.readdir
Since:
  • 4.0.0
Returns:
Type Description
Promise.<{status: Number, data: (Array.<DKTools.IO.File>|null)}> All JSON files

getName ()String inherited

Returns the name of the entity without an extension
Since:
  • 3.0.0
Returns:
Type Description
String Name of the entity without an extension

getPath ()String inherited

Returns the path
Since:
  • 3.0.0
Returns:
Type Description
String Path

getRootDirectory ()DKTools.IO.Directory

Returns the root directory
Since:
  • 6.3.0
Returns:
Type Description
DKTools.IO.Directory Root directory

getStats (object)Object inherited

Returns a stats Returns an object with 2 properties: status - Result of an operation data - Loaded data if the status is not equal to DKTools.IO.OK then data will be null Possible statuses: DKTools.IO.OK DKTools.IO.EXPECT_CALLBACK DKTools.IO.ERROR_NOT_LOCAL_MODE DKTools.IO.ERROR_PATH_DOES_NOT_EXIST DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE
Name Type Description
object Object Options of an operation
Name Type Description
sync Boolean optional Use synchronous version of stat
onSuccess function optional Callback function upon completion of an operation (only for object.sync == false)
onError function optional Callback function upon completion of an operation with error (only for object.sync == false)
Version:
  • 8.0.0
Since:
  • 2.0.0
Returns:
Type Description
Object Loaded stats

getStatsAsync ()Promise.<Object> async inherited

Returns a stats Asynchronous version of DKTools.IO.Entity.prototype.getStats Promise resolves an object with 2 properties: status - Result of an operation data - Loaded data if the status is not equal to DKTools.IO.OK then data will be null Possible statuses: DKTools.IO.OK DKTools.IO.ERROR_NOT_LOCAL_MODE DKTools.IO.ERROR_PATH_DOES_NOT_EXIST
Version:
  • 6.1.0
Since:
  • 4.0.0
Returns:
Type Description
Promise.<Object> Loaded stats

getTxtFiles (object)Object

Returns all txt files Returns an object with 2 properties: status - Result of an operation data - Array with files if the status is not equal to DKTools.IO.OK then data will be null Possible statuses: DKTools.IO.OK DKTools.IO.EXPECT_CALLBACK DKTools.IO.ERROR_NOT_LOCAL_MODE DKTools.IO.ERROR_PATH_DOES_NOT_EXIST DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE
Name Type Description
object Object Options of an operation
Name Type Description
sync Boolean optional Use synchronous version of FileSystem.readdir
options String | Object optional Options for FileSystem.readdir or FileSystem.readdirSync
onSuccess function optional Callback function upon completion of an operation (only for object.sync == false)
onError function optional Callback function upon completion of an operation with error (only for object.sync == false)
Version:
  • 7.0.0
Since:
  • 5.0.0
Returns:
Type Description
Object All txt files

getTxtFilesAsync (object)Promise.<{status: Number, data: (Array.<DKTools.IO.File>|null)}> async

Returns all txt files Asynchronous version of DKTools.IO.Directory.prototype.getTxtFiles Promise resolves an object with 2 properties: status - Result of an operation data - Array with files if the status is not equal to DKTools.IO.OK then data will be null Possible statuses: DKTools.IO.OK DKTools.IO.ERROR_NOT_LOCAL_MODE DKTools.IO.ERROR_PATH_DOES_NOT_EXIST
Name Type Default Description
object Object {} optional Options of an operation
Name Type Description
options String | Object optional Options for FileSystem.readdir
Since:
  • 5.0.0
Returns:
Type Description
Promise.<{status: Number, data: (Array.<DKTools.IO.File>|null)}> All txt files

getVideoFiles (object)Object

Returns all video files Returns an object with 2 properties: status - Result of an operation data - Array with files if the status is not equal to DKTools.IO.OK then data will be null Possible statuses: DKTools.IO.OK DKTools.IO.EXPECT_CALLBACK DKTools.IO.ERROR_NOT_LOCAL_MODE DKTools.IO.ERROR_PATH_DOES_NOT_EXIST DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE
Name Type Description
object Object Options of an operation
Name Type Description
sync Boolean optional Use synchronous version of FileSystem.readdir
options String | Object optional Options for FileSystem.readdir or FileSystem.readdirSync
onSuccess function optional Callback function upon completion of an operation (only for object.sync == false)
onError function optional Callback function upon completion of an operation with error (only for object.sync == false)
Version:
  • 7.0.0
Since:
  • 3.0.0
Returns:
Type Description
Object All video files

getVideoFilesAsync (object)Promise.<{status: Number, data: (Array.<DKTools.IO.File>|null)}> async

Returns all video files Asynchronous version of DKTools.IO.Directory.prototype.getVideoFiles Promise resolves an object with 2 properties: status - Result of an operation data - Array with files if the status is not equal to DKTools.IO.OK then data will be null Possible statuses: DKTools.IO.OK DKTools.IO.ERROR_NOT_LOCAL_MODE DKTools.IO.ERROR_PATH_DOES_NOT_EXIST
Name Type Default Description
object Object {} optional Options of an operation
Name Type Description
options String | Object optional Options for FileSystem.readdir
Since:
  • 4.0.0
Returns:
Type Description
Promise.<{status: Number, data: (Array.<DKTools.IO.File>|null)}> All video files

hasExtension ()Boolean inherited

Returns true if the entity has an extension
Since:
  • 5.0.0
Returns:
Type Description
Boolean Entity has an extension

initialize (fullPath) inherited

Initializes the entity
Name Type Description
fullPath String Path to entity
Version:
  • 11.2.3
Since:
  • 3.0.0

isDirectory ()Boolean inherited

Returns true if the entity is a directory
Version:
  • 5.0.0
Since:
  • 2.0.0
Returns:
Type Description
Boolean Entity is a directory

isEmpty ()Boolean

Returns true if the directory does not contain files and other directories
Returns:
Type Description
Boolean Directory does not contain files and other directories

isFile ()Boolean inherited

Returns true if the entity is a file
Version:
  • 6.2.1
Since:
  • 2.0.0
Returns:
Type Description
Boolean Entity is a file

loadAudioFiles ()Array.<WebAudio>

Loads and returns an audio files
Since:
  • 3.0.0
Returns:
Type Description
Array.<WebAudio> Loaded audio files

loadAudioFilesAsync ()Promise.<Array.<WebAudio>> async

Loads and returns an audio files Asynchronous version of DKTools.IO.Directory.prototype.loadAudioFiles Promise resolves a loaded audio files (WebAudio[])
Version:
  • 5.0.0
Since:
  • 4.0.0
Returns:
Type Description
Promise.<Array.<WebAudio>> Loaded audio files

loadBitmaps (object, hue, smooth)Array.<Bitmap>

Loads and returns a bitmaps
Name Type Description
object function | Object optional Function of processing after loading a bitmap or object with parameter
hue Number optional Hue of bitmap (if object is Object)
smooth Boolean optional Smooth of bitmap (if object is Object)
object.listener function optional Function of processing after loading a bitmap
object.hue Number optional Hue of bitmap
object.smooth Boolean optional Smooth of bitmap
Since:
  • 3.0.0
Returns:
Type Description
Array.<Bitmap> Loaded bitmaps

loadBitmapsAsync (object, hue, smooth)Promise.<Array.<Bitmap>> async

Loads and returns a bitmaps Asynchronous version of DKTools.IO.Directory.prototype.loadBitmaps Promise resolves a loaded bitmaps (Bitmap[])
Name Type Description
object function | Object optional Function of processing after loading a bitmap or object with parameter
hue Number optional Hue of bitmap (if object is Object)
smooth Boolean optional Smooth of bitmap (if object is Object)
object.listener function optional Function of processing after loading a bitmap
object.hue Number optional Hue of bitmap
object.smooth Boolean optional Smooth of bitmap
Since:
  • 4.0.0
Returns:
Type Description
Promise.<Array.<Bitmap>> Loaded bitmaps

remove (object)Number

Removes the directory Returns a code of the result of an operation Possible results: DKTools.IO.OK DKTools.IO.EXPECT_CALLBACK DKTools.IO.ERROR_NOT_LOCAL_MODE DKTools.IO.ERROR_PATH_DOES_NOT_EXIST DKTools.IO.ERROR_DIRECTORY_IS_NOT_EMPTY
Name Type Default Description
object Object {} optional Options of an operation
Name Type Description
sync Boolean optional Use synchronous version of FileSystem.rmdir
onSuccess function optional Callback function upon completion of an operation (only for object.sync == false)
onError function optional Callback function upon completion of an operation with error (only for object.sync == false)
Version:
  • 10.0.0
Returns:
Type Description
Number Code of the result of an operation

removeAsync ()Promise.<Number> async

Removes the directory Asynchronous version of DKTools.IO.Directory.prototype.remove Promise resolves a code of the result of an operation Possible results: DKTools.IO.OK DKTools.IO.ERROR_NOT_LOCAL_MODE DKTools.IO.ERROR_PATH_DOES_NOT_EXIST DKTools.IO.ERROR_DIRECTORY_IS_NOT_EMPTY
Since:
  • 4.0.0
Returns:
Type Description
Promise.<Number> Code of the result of an operation

rename (newName, object)Number inherited

Renames the entity (file or directory) Returns a code of the result of an operation Possible results: DKTools.IO.OK DKTools.IO.EXPECT_CALLBACK DKTools.IO.ERROR_NOT_LOCAL_MODE DKTools.IO.ERROR_PATH_DOES_NOT_EXIST DKTools.IO.ERROR_OVERWRITING_IS_NOT_AVAILABLE
Name Type Default Description
newName String New name of entity (file or directory) without the extension
object Object {} optional Options of an operation
Name Type Description
sync Boolean optional Use synchronous version of rename
overwrite Boolean optional Overwrite existing entity
onSuccess function optional Callback function upon completion of an operation (only for object.sync == false)
onError function optional Callback function upon completion of an operation with error (only for object.sync == false)
Version:
  • 7.0.0
Returns:
Type Description
Number Code of the result of an operation

renameAsync (newName, object)Promise.<Number> async inherited

Renames the entity (file or directory) Asynchronous version of DKTools.IO.Entity.prototype.rename Promise resolves a code of the result of an operation Possible results: DKTools.IO.OK DKTools.IO.ERROR_NOT_LOCAL_MODE DKTools.IO.ERROR_PATH_DOES_NOT_EXIST DKTools.IO.ERROR_OVERWRITING_IS_NOT_AVAILABLE
Name Type Default Description
newName String New name of entity without the extension
object Object {} optional Options of an operation
Name Type Description
overwrite Boolean optional Overwrite existing entity
Version:
  • 7.0.0
Since:
  • 4.0.0
Returns:
Type Description
Promise.<Number> Code of the result of an operation

reserveBitmaps (object, hue, smooth, reservationId)Array.<Bitmap>

Loads, reserves and returns a bitmaps
Name Type Description
object function | Object optional Function of processing after loading a bitmap or object with parameter
hue Number optional Hue of bitmap (if object is Object)
smooth Boolean optional Smooth of bitmap (if object is Object)
reservationId Number optional Reservation ID (if object is Object)
object.listener function optional Function of processing after loading a bitmap
object.hue Number optional Hue of bitmap
object.smooth Boolean optional Smooth of bitmap
object.reservationId Number optional Reservation ID
Since:
  • 3.0.0
Returns:
Type Description
Array.<Bitmap> Loaded bitmaps

reserveBitmapsAsync (object, hue, smooth, reservationId)Promise.<Array.<Bitmap>> async

Loads, reserves and returns a bitmaps Asynchronous version of DKTools.IO.Directory.prototype.reserveBitmaps Promise resolves a loaded bitmaps (Bitmap[])
Name Type Description
object function | Object optional Function of processing after loading a bitmap or object with parameter
hue Number optional Hue of bitmap (if object is Object)
smooth Boolean optional Smooth of bitmap (if object is Object)
reservationId Number optional Reservation ID (if object is Object)
object.listener function optional Function of processing after loading a bitmap
object.hue Number optional Hue of bitmap
object.smooth Boolean optional Smooth of bitmap
object.reservationId Number optional Reservation ID
Since:
  • 4.0.0
Returns:
Type Description
Promise.<Array.<Bitmap>> Loaded bitmaps