Provides operations related to working with files in the effect F
.
Provides operations related to working with files in the effect F
.
An instance is available for any effect F
which has an Async[F]
instance.
- Companion
- object
Value members
Abstract methods
Copies a file from the source to the target path,
Copies a file from the source to the target path,
By default, the copy fails if the target file already exists or is a symbolic link.
Creates a new directory at the given path and creates all nonexistent parent directories beforehand.
Creates a new directory at the given path and creates all nonexistent parent directories beforehand.
Deletes a file.
Deletes a file.
If the file is a directory then the directory must be empty for this action to succeed. This action will fail if the path doesn't exist.
Like delete
, but will not fail when the path doesn't exist.
Like delete
, but will not fail when the path doesn't exist.
Creates a stream of Paths inside a directory, filtering the results by the given predicate.
Creates a stream of Paths inside a directory, filtering the results by the given predicate.
Creates a stream of Paths inside a directory which match the given glob.
Creates a stream of Paths inside a directory which match the given glob.
Checks if a file exists.
Checks if a file exists.
Note that the result of this method is immediately outdated. If this method indicates the file exists then there is no guarantee that a subsequence access will succeed. Care should be taken when using this method in security sensitive applications.
Tests whether a file is a directory.
Tests whether a file is a directory.
The options sequence may be used to indicate how symbolic links are handled for the case that the file is a symbolic link. By default, symbolic links are followed and the file attribute of the final target of the link is read. If the option NOFOLLOW_LINKS is present then symbolic links are not followed.
Where is it required to distinguish an I/O exception from the case that the file is not a directory then the file attributes can be read with the readAttributes method and the file type tested with the BasicFileAttributes.isDirectory() method.
- Value Params
- options
- options indicating how symbolic links are handled
- path
the path to the file to test
- Returns
true if the file is a directory; false if the file does not exist, is not a directory, or it cannot be determined if the file is a directory or not.
Tests whether a file is a regular file with opaque content.
Tests whether a file is a regular file with opaque content.
The options sequence may be used to indicate how symbolic links are handled for the case that the file is a symbolic link. By default, symbolic links are followed and the file attribute of the final target of the link is read. If the option NOFOLLOW_LINKS is present then symbolic links are not followed.
Where is it required to distinguish an I/O exception from the case that the file is not a regular file then the file attributes can be read with the readAttributes method and the file type tested with the BasicFileAttributes.isRegularFile() method.
- Value Params
- options
options indicating how symbolic links are handled
- path
the path to the file
- Returns
true if the file is a regular file; false if the file does not exist, is not a regular file, or it cannot be determined if the file is a regular file or not.
Moves (or renames) a file from the source to the target path.
Moves (or renames) a file from the source to the target path.
By default, the move fails if the target file already exists or is a symbolic link.
Creates a FileHandle
for the file at the supplied Path
.
Creates a FileHandle
for the file at the supplied Path
.
Creates a FileHandle
for the supplied FileChannel
.
Creates a FileHandle
for the supplied FileChannel
.
Get file permissions as set of PosixFilePermission.
Get file permissions as set of PosixFilePermission.
Note: this will only work for POSIX supporting file systems.
Reads all data from the file at the specified java.nio.file.Path
.
Reads all data from the file at the specified java.nio.file.Path
.
Returns a ReadCursor
for the specified path. The READ
option is added to the supplied flags.
Returns a ReadCursor
for the specified path. The READ
option is added to the supplied flags.
Reads a range of data synchronously from the file at the specified java.nio.file.Path
.
start
is inclusive, end
is exclusive, so when start
is 0 and end
is 2,
two bytes are read.
Reads a range of data synchronously from the file at the specified java.nio.file.Path
.
start
is inclusive, end
is exclusive, so when start
is 0 and end
is 2,
two bytes are read.
Set file permissions from set of PosixFilePermission.
Set file permissions from set of PosixFilePermission.
Note: this will only work for POSIX supporting file systems.
Returns an infinite stream of data from the file at the specified path.
Starts reading from the specified offset and upon reaching the end of the file,
polls every pollDuration
for additional updates to the file.
Returns an infinite stream of data from the file at the specified path.
Starts reading from the specified offset and upon reaching the end of the file,
polls every pollDuration
for additional updates to the file.
Read operations are limited to emitting chunks of the specified chunk size but smaller chunks may occur.
If an error occurs while reading from the file, the overall stream fails.
Creates a Resource which can be used to create a temporary directory. The directory is created during resource allocation, and removed during its release.
Creates a Resource which can be used to create a temporary directory. The directory is created during resource allocation, and removed during its release.
- Value Params
- attributes
an optional list of file attributes to set atomically when creating the directory
- dir
the directory which the temporary directory will be created in. Pass in None to use the default system temp directory
- prefix
the prefix string to be used in generating the directory's name
- Returns
a resource containing the path of the temporary directory
Creates a Resource which can be used to create a temporary file. The file is created during resource allocation, and removed during its release.
Creates a Resource which can be used to create a temporary file. The file is created during resource allocation, and removed during its release.
- Value Params
- attributes
an optional list of file attributes to set atomically when creating the file
- dir
the directory which the temporary file will be created in. Pass in None to use the default system temp directory
- prefix
the prefix string to be used in generating the file's name
- suffix
the suffix string to be used in generating the file's name
- Returns
a resource containing the path of the temporary file
Creates a stream of Paths contained in a given file tree. Depth is unlimited.
Creates a stream of Paths contained in a given file tree. Depth is unlimited.
Creates a stream of Paths contained in a given file tree, respecting the supplied options. Depth is unlimited.
Creates a stream of Paths contained in a given file tree, respecting the supplied options. Depth is unlimited.
Creates a stream of Paths contained in a given file tree down to a given depth.
Creates a stream of Paths contained in a given file tree down to a given depth.
Watches a single path.
Watches a single path.
Alias for creating a watcher and watching the supplied path, releasing the watcher when the resulting stream is finalized.
Writes all data to the file at the specified java.nio.file.Path
.
Writes all data to the file at the specified java.nio.file.Path
.
Adds the WRITE flag to any other OpenOption
flags specified. By default, also adds the CREATE flag.
Returns a WriteCursor
for the specified path.
Returns a WriteCursor
for the specified path.
The WRITE
option is added to the supplied flags. If the APPEND
option is present in flags
,
the offset is initialized to the current size of the file.
Returns a WriteCursor
for the specified file handle.
Returns a WriteCursor
for the specified file handle.
If append
is true, the offset is initialized to the current size of the file.
Writes all data to a sequence of files, each limited in size to limit
.
Writes all data to a sequence of files, each limited in size to limit
.
The computePath
operation is used to compute the path of the first file
and every subsequent file. Typically, the next file should be determined
by analyzing the current state of the filesystem -- e.g., by looking at all
files in a directory and generating a unique name.