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.
The blocking versions are named xxxBlocking
and return the results, or throw exceptions directly.
In many cases, depending on the operating system and file system some of the potentially blocking operations
can return quickly, which is why we provide them, but it's highly recommended that you test how long they take to
return in your particular application before using them on an event loop.
Please consult the documentation for more information on file system support.
package |
Default |
---|
__construct()
chmod( $arg0, $arg1, $arg2) : $this
The permission String takes the form rwxr-x--- as specified here.
string
string
callable
$this
a reference to this, so the API can be used fluently
chmodBlocking( $arg0, $arg1) : $this
string
string
$this
chmodRecursive( $arg0, $arg1, $arg2, $arg3) : $this
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
.
string
string
string
callable
$this
a reference to this, so the API can be used fluently
chmodRecursiveBlocking( $arg0, $arg1, $arg2) : $this
string
string
string
$this
chown( $arg0, $arg1, $arg2, $arg3) : $this
string
string
string
callable
$this
a reference to this, so the API can be used fluently
chownBlocking( $arg0, $arg1, $arg2) : $this
string
string
string
$this
copy( $arg0, $arg1, $arg2, $arg3 = null) : $this
The copy will fail if the destination already exists.
param $from [string] the path to copy from
param $to [string] the path to copy to
param $handler [callable] the handler that will be called on completion
copy($from, $to, $handler)
Copy a file from the path from
to path to
, asynchronously.
param $from [string] the path to copy from
param $to [string] the path to copy to
param $options [CopyOptions | array] options describing how the file should be copied
param $handler [callable] the handler that will be called on completion
copy($from, $to, $options, $handler)
string
string
callable | array | CopyOptions
callable
$this
a reference to this, so the API can be used fluently
copyBlocking( $arg0, $arg1) : $this
string
string
$this
copyRecursive( $arg0, $arg1, $arg2, $arg3) : $this
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.
string
string
boolean
callable
$this
a reference to this, so the API can be used fluently
copyRecursiveBlocking( $arg0, $arg1, $arg2) : $this
string
string
boolean
$this
createFile( $arg0, $arg1, $arg2 = null) : $this
param $path [string] path to the file param $handler [callable] the handler that will be called on completion createFile($path, $handler)
Creates an empty file with the specified path
and permissions perms
, asynchronously.
param $path [string] path to the file param $perms [string] the permissions string param $handler [callable] the handler that will be called on completion createFile($path, $perms, $handler)
string
callable | string
callable
$this
a reference to this, so the API can be used fluently
createFileBlocking( $arg0, $arg1 = null) : $this
param $path [string] createFileBlocking($path)
Blocking version of @see \io\vertx\jphp\core\file\FileSystem::createFile
param $path [string] param $perms [string] createFileBlocking($path, $perms)
string
string
$this
createTempDirectory( $arg0, $arg1, $arg2 = null, $arg3 = null) : $this
As with the File.createTempFile
methods, this method is only
part of a temporary-file facility.A \java.lang.Runtime,
or the \java.io.File mechanism may be used to delete the directory automatically.
param $prefix [string] the prefix string to be used in generating the directory's name; may be {@code null} param $handler [callable] the handler that will be called on completion createTempDirectory($prefix, $handler)
Creates a new directory in the default temporary-file directory, using the given prefix to generate its name, 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.
As with the File.createTempFile
methods, this method is only
part of a temporary-file facility.A \java.lang.Runtime,
or the \java.io.File mechanism may be used to delete the directory automatically.
param $prefix [string] the prefix string to be used in generating the directory's name; may be {@code null} param $perms [string] the permissions string param $handler [callable] the handler that will be called on completion createTempDirectory($prefix, $perms, $handler)
Creates a new directory in the directory provided by the path path
, using the given
prefix to generate its name, 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.
As with the File.createTempFile
methods, this method is only
part of a temporary-file facility.A \java.lang.Runtime,
or the \java.io.File mechanism may be used to delete the directory automatically.
param $dir [string] the path to directory in which to create the directory param $prefix [string] the prefix string to be used in generating the directory's name; may be {@code null} param $perms [string] the permissions string param $handler [callable] the handler that will be called on completion createTempDirectory($dir, $prefix, $perms, $handler)
string
callable | string
callable | string
callable
$this
a reference to this, so the API can be used fluently
createTempDirectoryBlocking( $arg0, $arg1 = null, $arg2 = null) : string
param $prefix [string] createTempDirectoryBlocking($prefix)
Blocking version of @see \io\vertx\jphp\core\file\FileSystem::createTempDirectory
param $prefix [string] param $perms [string] createTempDirectoryBlocking($prefix, $perms)
Blocking version of @see \io\vertx\jphp\core\file\FileSystem::createTempDirectory
param $dir [string] param $prefix [string] param $perms [string] createTempDirectoryBlocking($dir, $prefix, $perms)
string
string
string
string
createTempFile( $arg0, $arg1, $arg2, $arg3 = null, $arg4 = null) : $this
As with the File.createTempFile
methods, this method is only
part of a temporary-file facility.A \java.lang.Runtime,
or the \java.io.File mechanism may be used to delete the directory automatically.
param $prefix [string] the prefix string to be used in generating the directory's name; may be {@code null} param $suffix [string] the suffix string to be used in generating the file's name; may be {@code null}, in which case "{@code .tmp}" is used param $handler [callable] the handler that will be called on completion createTempFile($prefix, $suffix, $handler)
Creates a new file in the directory provided by the path dir
, using the given
prefix and suffix to generate its name, asynchronously.
As with the File.createTempFile
methods, this method is only
part of a temporary-file facility.A \java.lang.Runtime,
or the \java.io.File mechanism may be used to delete the directory automatically.
param $prefix [string] the prefix string to be used in generating the directory's name; may be {@code null} param $suffix [string] the suffix string to be used in generating the file's name; may be {@code null}, in which case "{@code .tmp}" is used param $perms [string] param $handler [callable] the handler that will be called on completion createTempFile($prefix, $suffix, $perms, $handler)
Creates a new file in the directory provided by the path dir
, using the given
prefix and suffix to generate its name, 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.
As with the File.createTempFile
methods, this method is only
part of a temporary-file facility.A \java.lang.Runtime,
or the \java.io.File mechanism may be used to delete the directory automatically.
param $dir [string] the path to directory in which to create the directory param $prefix [string] the prefix string to be used in generating the directory's name; may be {@code null} param $suffix [string] the suffix string to be used in generating the file's name; may be {@code null}, in which case "{@code .tmp}" is used param $perms [string] the permissions string param $handler [callable] the handler that will be called on completion createTempFile($dir, $prefix, $suffix, $perms, $handler)
string
string
callable | string
callable | string
callable
$this
a reference to this, so the API can be used fluently
createTempFileBlocking( $arg0, $arg1, $arg2 = null, $arg3 = null) : string
param $prefix [string] param $suffix [string] createTempFileBlocking($prefix, $suffix)
Blocking version of @see \io\vertx\jphp\core\file\FileSystem::createTempFile
param $prefix [string] param $suffix [string] param $perms [string] createTempFileBlocking($prefix, $suffix, $perms)
Blocking version of @see \io\vertx\jphp\core\file\FileSystem::createTempFile
param $dir [string] param $prefix [string] param $suffix [string] param $perms [string] createTempFileBlocking($dir, $prefix, $suffix, $perms)
string
string
string
string
string
delete( $arg0, $arg1) : $this
string
callable
$this
a reference to this, so the API can be used fluently
deleteBlocking( $arg0) : $this
string
$this
deleteRecursive( $arg0, $arg1, $arg2) : $this
If the path represents a directory and recursive = true
then the directory and its contents will be
deleted recursively.
string
boolean
callable
$this
a reference to this, so the API can be used fluently
deleteRecursiveBlocking( $arg0, $arg1) : $this
string
boolean
$this
exists( $arg0, $arg1) : $this
string
callable
$this
a reference to this, so the API can be used fluently
existsBlocking( $arg0) : boolean
string
boolean
fsProps( $arg0, $arg1) : $this
string
callable
$this
a reference to this, so the API can be used fluently
fsPropsBlocking( $arg0) : \io\vertx\jphp\core\file\FileSystemProps
link( $arg0, $arg1, $arg2) : $this
string
string
callable
$this
a reference to this, so the API can be used fluently
linkBlocking( $arg0, $arg1) : $this
string
string
$this
lprops( $arg0, $arg1) : $this
The link will not be followed.
string
callable
$this
a reference to this, so the API can be used fluently
lpropsBlocking( $arg0) : \io\vertx\jphp\core\file\FileProps
mkdir( $arg0, $arg1, $arg2 = null) : $this
The operation will fail if the directory already exists.
param $path [string] path to the file
param $handler [callable] the handler that will be called on completion
mkdir($path, $handler)
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. param $path [string] path to the file param $perms [string] the permissions string param $handler [callable] the handler that will be called on completion mkdir($path, $perms, $handler)
string
callable | string
callable
$this
a reference to this, so the API can be used fluently
mkdirBlocking( $arg0, $arg1 = null) : $this
param $path [string] mkdirBlocking($path)
Blocking version of @see \io\vertx\jphp\core\file\FileSystem::mkdir
param $path [string] param $perms [string] mkdirBlocking($path, $perms)
string
string
$this
mkdirs( $arg0, $arg1, $arg2 = null) : $this
The operation will fail if the directory already exists.
param $path [string] path to the file
param $handler [callable] the handler that will be called on completion
mkdirs($path, $handler)
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.
param $path [string] path to the file param $perms [string] the permissions string param $handler [callable] the handler that will be called on completion mkdirs($path, $perms, $handler)
string
callable | string
callable
$this
a reference to this, so the API can be used fluently
mkdirsBlocking( $arg0, $arg1 = null) : $this
param $path [string] mkdirsBlocking($path)
Blocking version of @see \io\vertx\jphp\core\file\FileSystem::mkdirs
param $path [string] param $perms [string] mkdirsBlocking($path, $perms)
string
string
$this
move( $arg0, $arg1, $arg2, $arg3 = null) : $this
The move will fail if the destination already exists.
param $from [string] the path to copy from
param $to [string] the path to copy to
param $handler [callable] the handler that will be called on completion
move($from, $to, $handler)
Move a file from the path from
to path to
, asynchronously.
param $from [string] the path to copy from
param $to [string] the path to copy to
param $options [CopyOptions | array] options describing how the file should be copied
param $handler [callable] the handler that will be called on completion
move($from, $to, $options, $handler)
string
string
callable | array | CopyOptions
callable
$this
a reference to this, so the API can be used fluently
moveBlocking( $arg0, $arg1) : $this
string
string
$this
open( $arg0, $arg1, $arg2) : $this
The file is opened for both reading and writing. If the file does not already exist it will be created.
string
OpenOptions | array
callable
$this
a reference to this, so the API can be used fluently
openBlocking( $arg0, $arg1) : \io\vertx\jphp\core\file\AsyncFile
props( $arg0, $arg1) : $this
If the file is a link, the link will be followed.
string
callable
$this
a reference to this, so the API can be used fluently
propsBlocking( $arg0) : \io\vertx\jphp\core\file\FileProps
readDir( $arg0, $arg1, $arg2 = null) : $this
The result is an array of String representing the paths of the files inside the directory.
param $path [string] path to the file
param $handler [callable] the handler that will be called on completion
readDir($path, $handler)
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. param $path [string] path to the directory param $filter [string] the filter expression param $handler [callable] the handler that will be called on completion readDir($path, $filter, $handler)
string
callable | string
callable
$this
a reference to this, so the API can be used fluently
readDirBlocking( $arg0, $arg1 = null) : array
param $path [string] readDirBlocking($path)
Blocking version of @see \io\vertx\jphp\core\file\FileSystem::readDir
param $path [string] param $filter [string] readDirBlocking($path, $filter)
string
string
array
readFile( $arg0, $arg1) : $this
Do not use this method to read very large files or you risk running out of available RAM.
string
callable
$this
a reference to this, so the API can be used fluently
readFileBlocking( $arg0) : \io\vertx\jphp\core\buffer\Buffer
readSymlink( $arg0, $arg1) : $this
string
callable
$this
a reference to this, so the API can be used fluently
readSymlinkBlocking( $arg0) : string
string
string
symlink( $arg0, $arg1, $arg2) : $this
string
string
callable
$this
a reference to this, so the API can be used fluently
symlinkBlocking( $arg0, $arg1) : $this
string
string
$this
truncate( $arg0, $arg1, $arg2) : $this
The operation will fail if the file does not exist or len
is less than zero
.
string
integer
callable
$this
a reference to this, so the API can be used fluently
truncateBlocking( $arg0, $arg1) : $this
string
integer
$this
unlink( $arg0, $arg1) : $this
string
callable
$this
a reference to this, so the API can be used fluently
unlinkBlocking( $arg0) : $this
string
$this
writeFile( $arg0, $arg1, $arg2) : $this
string
Buffer
callable
$this
a reference to this, so the API can be used fluently
writeFileBlocking( $arg0, $arg1) : $this
string
Buffer
$this