Skip to content

Latest commit

 

History

History
70 lines (49 loc) · 2.69 KB

dir.jsdoc.md

File metadata and controls

70 lines (49 loc) · 2.69 KB

Dir

Dir class port of ruby.

As JavaScript does not support bracket methods, we have a getter and setter instead.

For node js only, does not work inside a browser.

Dir.glob(pattern, options, base_path) → Array.<string> | null

Expands pattern, which is a pattern string or an Array of pattern strings, and returns an array containing the matching filenames.

Param Type Description
pattern string | Array.<string>
options object of npm package 'glob'
base_path string shortcut of options.cwd with higher prio

Dir.pwd() → string

Returns the path to the current working directory of this process as a string.

Dir.chdir(dir)

Changes the current working directory of the process to the given string.

When called without an argument, changes the directory to the value of the environment variable HOME, or LOGDIR or the operating systems home directory by API. Throws:

  • Error if directory can not be changed
Param Type
dir string

Dir.delete(file_name, opts)

Deletes the named directory.

Param Type Default Description
file_name string
opts Object
opts.recursive boolean false If true, perform a recursive directory removal. In recursive mode, operations are retried on failure
opts.max_retries boolean 0 If an EBUSY, EMFILE, ENFILE, ENOTEMPTY, or EPERM error is encountered, Node.js retries the operation with a linear backoff wait of retryDelay milliseconds longer on each try. This option represents the number of retries. This option is ignored if the recursive option is not true
opts.retry_delay boolean 100 The amount of time in milliseconds to wait between retries. This option is ignored if the recursive option is not true

Dir.isExisting(file_name) → boolean

Returns true if the named file is a directory, false otherwise.

Param Type
file_name string