# Class: FileSystem

## vertx-js/file_system~ FileSystem

#### new FileSystem()

  Contains a broad set of operations for manipulating files on the file system.

  A (potential) blocking and non blocking version of each operation is provided.

  The non blocking versions take a handler which is called when the operation completes or an error occurs.

  Source:
    - file_system.js, line 38

### Methods

#### chmod(path, perms, handler) → {FileSystem}

  Change the permissions on the file represented by `path` to `perms`, asynchronously.

  The permission String takes the form rwxr-x--- as specified here.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `path` | string | the path to the file
  `perms` | string | the permissions string
  `handler` | function | the handler that will be called on completion

  Source:
    - file_system.js, line 224

  ##### Returns:

  a reference to this, so the API can be used fluently
  Type
    FileSystem

#### chmodBlocking(path, perms) → {FileSystem}

  Blocking version of [#chmod(String, String, Handler)] FileSystem

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `path` | string |
  `perms` | string |

  Source:
    - file_system.js, line 246

  ##### Returns:

  Type
    FileSystem

#### chmodRecursive(path, perms, dirPerms, handler) → {FileSystem}

  Change the permissions on the file represented by `path` to `perms`, asynchronously.

  The permission String takes the form rwxr-x--- as specified in {here}.

  If the file is directory then all contents will also have their permissions changed recursively. Any directory permissions will be set to `dirPerms`, whilst any normal file permissions will be set to `perms`.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `path` | string | the path to the file
  `perms` | string | the permissions string
  `dirPerms` | string | the directory permissions
  `handler` | function | the handler that will be called on completion

  Source:
    - file_system.js, line 269

  ##### Returns:

  a reference to this, so the API can be used fluently
  Type
    FileSystem

#### chmodRecursiveBlocking(path, perms, dirPerms) → {FileSystem}

  Blocking version of FileSystem#chmodRecursive

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `path` | string |
  `perms` | string |
  `dirPerms` | string |

  Source:
    - file_system.js, line 292

  ##### Returns:

  Type
    FileSystem

#### chown(path, user, group, handler) → {FileSystem}

  Change the ownership on the file represented by `path` to `user` and {code group}, asynchronously.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `path` | string | the path to the file
  `user` | string | the user name
  `group` | string | the user group
  `handler` | function | the handler that will be called on completion

  Source:
    - file_system.js, line 310

  ##### Returns:

  a reference to this, so the API can be used fluently
  Type
    FileSystem

#### chownBlocking(path, user, group) → {FileSystem}

  Blocking version of FileSystem#chown

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `path` | string |
  `user` | string |
  `group` | string |

  Source:
    - file_system.js, line 334

  ##### Returns:

  Type
    FileSystem

#### copy(from, to, handler) → {FileSystem}

  Copy a file from the path `from` to path `to`, asynchronously.

  The copy will fail if the destination already exists.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `from` | string | the path to copy from
  `to` | string | the path to copy to
  `handler` | function | the handler that will be called on completion

  Source:
    - file_system.js, line 54

  ##### Returns:

  a reference to this, so the API can be used fluently
  Type
    FileSystem

#### copyBlocking(from, to) → {FileSystem}

  Blocking version of FileSystem#copy

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `from` | string |
  `to` | string |

  Source:
    - file_system.js, line 76

  ##### Returns:

  Type
    FileSystem

#### copyRecursive(from, to, recursive, handler) → {FileSystem}

  Copy a file from the path `from` to path `to`, asynchronously.

  If `recursive` is `true` and `from` represents a directory, then the directory and its contents will be copied recursively to the destination `to`.

  The copy will fail if the destination if the destination already exists.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `from` | string | the path to copy from
  `to` | string | the path to copy to
  `recursive` | boolean |
  `handler` | function | the handler that will be called on completion

  Source:
    - file_system.js, line 99

  ##### Returns:

  a reference to this, so the API can be used fluently
  Type
    FileSystem

#### copyRecursiveBlocking(from, to, recursive) → {FileSystem}

  Blocking version of FileSystem#copyRecursive

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `from` | string |
  `to` | string |
  `recursive` | boolean |

  Source:
    - file_system.js, line 122

  ##### Returns:

  Type
    FileSystem

#### createFile(path, perms, handler) → {FileSystem}

  Creates an empty file with the specified `path` and permissions `perms`, asynchronously.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `path` | string | path to the file
  `perms` | string | the permissions string
  `handler` | function | the handler that will be called on completion

  Source:
    - file_system.js, line 945

  ##### Returns:

  a reference to this, so the API can be used fluently
  Type
    FileSystem

#### createFileBlocking(path, perms) → {FileSystem}

  Blocking version of FileSystem#createFile

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `path` | string |
  `perms` | string |

  Source:
    - file_system.js, line 976

  ##### Returns:

  Type
    FileSystem

#### delete(path, handler) → {FileSystem}

  Deletes the file represented by the specified `path`, asynchronously.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `path` | string | path to the file
  `handler` | function | the handler that will be called on completion

  Source:
    - file_system.js, line 577

  ##### Returns:

  a reference to this, so the API can be used fluently
  Type
    FileSystem

#### deleteBlocking(path) → {FileSystem}

  Blocking version of FileSystem#delete

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `path` | string |

  Source:
    - file_system.js, line 598

  ##### Returns:

  Type
    FileSystem

#### deleteRecursive(path, recursive, handler) → {FileSystem}

  Deletes the file represented by the specified `path`, asynchronously.

  If the path represents a directory and `recursive = true` then the directory and its contents will be deleted recursively.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `path` | string | path to the file
  `recursive` | boolean | delete recursively?
  `handler` | function | the handler that will be called on completion

  Source:
    - file_system.js, line 618

  ##### Returns:

  a reference to this, so the API can be used fluently
  Type
    FileSystem

#### deleteRecursiveBlocking(path, recursive) → {FileSystem}

  Blocking version of FileSystem#deleteRecursive

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `path` | string |
  `recursive` | boolean |

  Source:
    - file_system.js, line 640

  ##### Returns:

  Type
    FileSystem

#### exists(path, handler) → {FileSystem}

  Determines whether the file as specified by the path `path` exists, asynchronously.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `path` | string | path to the file
  `handler` | function | the handler that will be called on completion

  Source:
    - file_system.js, line 995

  ##### Returns:

  a reference to this, so the API can be used fluently
  Type
    FileSystem

#### existsBlocking(path) → {boolean}

  Blocking version of FileSystem#exists

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `path` | string |

  Source:
    - file_system.js, line 1016

  ##### Returns:

  Type
    boolean

#### fsProps(path, handler) → {FileSystem}

  Returns properties of the file-system being used by the specified `path`, asynchronously.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `path` | string | path to anywhere on the filesystem
  `handler` | function | the handler that will be called on completion

  Source:
    - file_system.js, line 1031

  ##### Returns:

  a reference to this, so the API can be used fluently
  Type
    FileSystem

#### fsPropsBlocking(path) → {FileSystemProps}

  Blocking version of FileSystem#fsProps

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `path` | string |

  Source:
    - file_system.js, line 1052

  ##### Returns:

  Type
    FileSystemProps

#### link(link, existing, handler) → {FileSystem}

  Create a hard link on the file system from `link` to `existing`, asynchronously.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `link` | string | the link
  `existing` | string | the link destination
  `handler` | function | the handler that will be called on completion

  Source:
    - file_system.js, line 427

  ##### Returns:

  a reference to this, so the API can be used fluently
  Type
    FileSystem

#### linkBlocking(link, existing) → {FileSystem}

  Blocking version of FileSystem#link

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `link` | string |
  `existing` | string |

  Source:
    - file_system.js, line 449

  ##### Returns:

  Type
    FileSystem

#### lprops(path, handler) → {FileSystem}

  Obtain properties for the link represented by `path`, asynchronously.

  The link will not be followed.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `path` | string | the path to the file
  `handler` | function | the handler that will be called on completion

  Source:
    - file_system.js, line 390

  ##### Returns:

  a reference to this, so the API can be used fluently
  Type
    FileSystem

#### lpropsBlocking(path) → {FileProps}

  Blocking version of FileSystem#lprops

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `path` | string |

  Source:
    - file_system.js, line 411

  ##### Returns:

  Type
    FileProps

#### mkdir(path, perms, handler) → {FileSystem}

  Create the directory represented by `path`, asynchronously.

  The new directory will be created with permissions as specified by `perms`.

  The permission String takes the form rwxr-x--- as specified in here.

  The operation will fail if the directory already exists.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `path` | string | path to the file
  `perms` | string | the permissions string
  `handler` | function | the handler that will be called on completion

  Source:
    - file_system.js, line 664

  ##### Returns:

  a reference to this, so the API can be used fluently
  Type
    FileSystem

#### mkdirBlocking(path, perms) → {FileSystem}

  Blocking version of FileSystem#mkdir

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `path` | string |
  `perms` | string |

  Source:
    - file_system.js, line 695

  ##### Returns:

  Type
    FileSystem

#### mkdirs(path, perms, handler) → {FileSystem}

  Create the directory represented by `path` and any non existent parents, asynchronously.

  The new directory will be created with permissions as specified by `perms`.

  The permission String takes the form rwxr-x--- as specified in here.

  The operation will fail if the directory already exists.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `path` | string | path to the file
  `perms` | string | the permissions string
  `handler` | function | the handler that will be called on completion

  Source:
    - file_system.js, line 722

  ##### Returns:

  a reference to this, so the API can be used fluently
  Type
    FileSystem

#### mkdirsBlocking(path, perms) → {FileSystem}

  Blocking version of FileSystem#mkdirs

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `path` | string |
  `perms` | string |

  Source:
    - file_system.js, line 753

  ##### Returns:

  Type
    FileSystem

#### move(from, to, handler) → {FileSystem}

  Move a file from the path `from` to path `to`, asynchronously.

  The move will fail if the destination already exists.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `from` | string | the path to copy from
  `to` | string | the path to copy to
  `handler` | function | the handler that will be called on completion

  Source:
    - file_system.js, line 141

  ##### Returns:

  a reference to this, so the API can be used fluently
  Type
    FileSystem

#### moveBlocking(from, to) → {FileSystem}

  Blocking version of FileSystem#move

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `from` | string |
  `to` | string |

  Source:
    - file_system.js, line 163

  ##### Returns:

  Type
    FileSystem

#### open(path, options, handler) → {FileSystem}

  Open the file represented by `path`, asynchronously.

  The file is opened for both reading and writing. If the file does not already exist it will be created.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `path` | string | path to the file
  `options` | Object | options describing how the file should be opened
  `handler` | function |

  Source:
    - file_system.js, line 907

  ##### Returns:

  a reference to this, so the API can be used fluently
  Type
    FileSystem

#### openBlocking(path, options) → {AsyncFile}

  Blocking version of FileSystem#open

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `path` | string |
  `options` | Object |

  Source:
    - file_system.js, line 929

  ##### Returns:

  Type
    AsyncFile

#### props(path, handler) → {FileSystem}

  Obtain properties for the file represented by `path`, asynchronously.

  If the file is a link, the link will be followed.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `path` | string | the path to the file
  `handler` | function | the handler that will be called on completion

  Source:
    - file_system.js, line 352

  ##### Returns:

  a reference to this, so the API can be used fluently
  Type
    FileSystem

#### propsBlocking(path) → {FileProps}

  Blocking version of FileSystem#props

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `path` | string |

  Source:
    - file_system.js, line 373

  ##### Returns:

  Type
    FileProps

#### readDir(path, filter, handler) → {FileSystem}

  Read the contents of the directory specified by `path`, asynchronously.

  The parameter `filter` is a regular expression. If `filter` is specified then only the paths that match @{filter}will be returned.

  The result is an array of String representing the paths of the files inside the directory.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `path` | string | path to the directory
  `filter` | string | the filter expression
  `handler` | function | the handler that will be called on completion

  Source:
    - file_system.js, line 778

  ##### Returns:

  a reference to this, so the API can be used fluently
  Type
    FileSystem

#### readDirBlocking(path, filter) → {Array.<string>}

  Blocking version of FileSystem#readDir

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `path` | string |
  `filter` | string |

  Source:
    - file_system.js, line 809

  ##### Returns:

  Type
    Array.<string>

#### readFile(path, handler) → {FileSystem}

  Reads the entire file as represented by the path `path` as a , asynchronously.

  Do not user this method to read very large files or you risk running out of available RAM.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `path` | string | path to the file
  `handler` | function | the handler that will be called on completion

  Source:
    - file_system.js, line 828

  ##### Returns:

  a reference to this, so the API can be used fluently
  Type
    FileSystem

#### readFileBlocking(path) → {Buffer}

  Blocking version of FileSystem#readFile

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `path` | string |

  Source:
    - file_system.js, line 849

  ##### Returns:

  Type
    Buffer

#### readSymlink(link, handler) → {FileSystem}

  Returns the path representing the file that the symbolic link specified by `link` points to, asynchronously.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `link` | string | the link
  `handler` | function | the handler that will be called on completion

  Source:
    - file_system.js, line 541

  ##### Returns:

  a reference to this, so the API can be used fluently
  Type
    FileSystem

#### readSymlinkBlocking(link) → {string}

  Blocking version of FileSystem#readSymlink

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `link` | string |

  Source:
    - file_system.js, line 562

  ##### Returns:

  Type
    string

#### symlink(link, existing, handler) → {FileSystem}

  Create a symbolic link on the file system from `link` to `existing`, asynchronously.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `link` | string | the link
  `existing` | string | the link destination
  `handler` | function | the handler that will be called on completion

  Source:
    - file_system.js, line 466

  ##### Returns:

  a reference to this, so the API can be used fluently
  Type
    FileSystem

#### symlinkBlocking(link, existing) → {FileSystem}

  Blocking version of FileSystem#link

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `link` | string |
  `existing` | string |

  Source:
    - file_system.js, line 488

  ##### Returns:

  Type
    FileSystem

#### truncate(path, len, handler) → {FileSystem}

  Truncate the file represented by `path` to length `len` in bytes, asynchronously.

  The operation will fail if the file does not exist or `len` is less than `zero`.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `path` | string | the path to the file
  `len` | number | the length to truncate it to
  `handler` | function | the handler that will be called on completion

  Source:
    - file_system.js, line 182

  ##### Returns:

  a reference to this, so the API can be used fluently
  Type
    FileSystem

#### truncateBlocking(path, len) → {FileSystem}

  Blocking version of FileSystem#truncate

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `path` | string |
  `len` | number |

  Source:
    - file_system.js, line 204

  ##### Returns:

  Type
    FileSystem

#### unlink(link, handler) → {FileSystem}

  Unlinks the link on the file system represented by the path `link`, asynchronously.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `link` | string | the link
  `handler` | function | the handler that will be called on completion

  Source:
    - file_system.js, line 504

  ##### Returns:

  a reference to this, so the API can be used fluently
  Type
    FileSystem

#### unlinkBlocking(link) → {FileSystem}

  Blocking version of FileSystem#unlink

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `link` | string |

  Source:
    - file_system.js, line 525

  ##### Returns:

  Type
    FileSystem

#### writeFile(path, data, handler) → {FileSystem}

  Creates the file, and writes the specified `Buffer data` to the file represented by the path `path`, asynchronously.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `path` | string | path to the file
  `data` | Buffer |
  `handler` | function | the handler that will be called on completion

  Source:
    - file_system.js, line 866

  ##### Returns:

  a reference to this, so the API can be used fluently
  Type
    FileSystem

#### writeFileBlocking(path, data) → {FileSystem}

  Blocking version of FileSystem#writeFile

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `path` | string |
  `data` | Buffer |

  Source:
    - file_system.js, line 888

  ##### Returns:

  Type
    FileSystem