package file
- Alphabetic
- By Inheritance
- file
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
- type AccessDeniedException = java.nio.file.AccessDeniedException
-
sealed
trait
BasicFileAttributes extends AnyRef
Attributes of a file that are provided by most operating systems and file systems.
Attributes of a file that are provided by most operating systems and file systems.
To get an instance of
BasicFileAttributes, useFiles[F].getBasicFileAttributes(path).The
fileKeyoperation returns a unique identifier for the file, if the operating system and file system supports providing such an identifier. - final class CopyFlag extends AnyVal
- case class CopyFlags(value: List[CopyFlag]) extends Product with Serializable
- type DirectoryNotEmptyException = java.nio.file.DirectoryNotEmptyException
- type FileAlreadyExistsException = java.nio.file.FileAlreadyExistsException
-
trait
FileHandle[F[_]] extends FileHandlePlatform[F]
Provides the ability to read/write/lock/inspect a file in the effect
F. -
trait
FileKey extends AnyRef
An opaque, unique identifier for a file.
An opaque, unique identifier for a file.
Paths which have the same
FileKey(via univerals equals), as reported byFiles[F].getBasicFileAttributes(path).fileKey, are guaranteed to reference the same file on the file system.Note: not all operating systems and file systems support file keys, hence
BasicFileAttributes#fileKeyreturns anOption[FileKey]. - type FileSystemException = java.nio.file.FileSystemException
- type FileSystemLoopException = java.nio.file.FileSystemLoopException
-
sealed
trait
Files[F[_]] extends FilesPlatform[F]
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
Fwhich has anAsync[F]instance.The operations on this trait are implemented for both the JVM and Node.js. Some operations only work on POSIX file systems, though such methods generally have "Posix" in their names (e.g.
getPosixPermissions). A small number of methods are only available on the JVM (e.g. variant oflistwhich takes a glob pattern) and are indicated as such in their ScalaDoc. - final class Flag extends AnyVal
-
case class
Flags(value: List[Flag]) extends Product with Serializable
Flags describing how a file should be opened by
Files[F].open(path, flags).Flags describing how a file should be opened by
Files[F].open(path, flags).Common flag combinations are available in the companion (e.g.
Flags.Write) Custom combinations are supported via theapplymethod (e.g.,Flags(Flag.Write, Flag.CreateNew)). - type NoSuchFileException = java.nio.file.NoSuchFileException
- type NotDirectoryException = java.nio.file.NotDirectoryException
-
final
class
Path extends PathApi
Path to a file or directory on a file system.
Path to a file or directory on a file system.
The path API is inspired by the
java.nio.file.PathAPI. On the JVM, a NIO path can be converted to an FS2 path viaPath.fromNioPath(p)and likewise an FS2 path can be converted to a NIO path viap.toNioPath.(When using this class on Node.js, the
fromNioPathandtoNioPathmethods are not accessible.)Generally, most methods have the same behavior as their NIO counterparts, though there are some slight differences -- e.g.,
resolvenormalizes. -
sealed
trait
Permissions extends PermissionsPlatform
Describes the permissions of a file / directory.
Describes the permissions of a file / directory.
Note: currently, there is only one subtype --
PosixPermissions. More types may be added in the future (e.g. Windows ACLs). - sealed trait PosixFileAttributes extends BasicFileAttributes
- sealed trait PosixPermission extends AnyRef
-
final
class
PosixPermissions extends Permissions
Describes POSIX file permissions, where the user, group, and others are each assigned read, write, and/or execute permissions.
Describes POSIX file permissions, where the user, group, and others are each assigned read, write, and/or execute permissions.
The
toStringmethod provides a 9 character string where the first three characters indicate user permissions, the next three group permissions, and the final three others permissions. For example,rwxr-xr--indicates the owner has read, write and execute, the group as read and execute, and others have read.The
valuefield encodes the permissions in the lowest 9 bits of an integer. bits 8-6 indicate read, write, and execute for the owner, 5-3 for the group, and 2-0 for others.rwxr-xr--has the integer value 111101100 = 492.The
toOctalStringmethod returns the a 3 digit string, where the first character indicates read, write and execute for the owner, the second digit for the group, and the third digit for others.rwxr-xr--has the octal string754.Constructors from strings, octal strings, and integers, as well as explicitly enumerating permissions, are provided in the companion.
-
final
case class
ReadCursor[F[_]](file: FileHandle[F], offset: Long) extends Product with Serializable
Associates a
FileHandlewith an offset in to the file.Associates a
FileHandlewith an offset in to the file.This encapsulates the pattern of incrementally reading bytes in from a file, a chunk at a time. Convenience methods are provided for working with pulls.
-
sealed abstract
class
Watcher[F[_]] extends AnyRef
Allows watching the file system for changes to directories and files by using the platform's
WatchService. -
final
case class
WriteCursor[F[_]](file: FileHandle[F], offset: Long) extends Product with Serializable
Associates a
FileHandlewith an offset in to the file.Associates a
FileHandlewith an offset in to the file.This encapsulates the pattern of incrementally writing bytes in to a file, a chunk at a time. Convenience methods are provided for working with pulls.
Value Members
- object BasicFileAttributes
- object CopyFlag extends CopyFlagCompanionApi
- object CopyFlags extends CopyFlagsCompanionPlatform with Serializable
- object FileHandle extends FileHandleCompanionPlatform
- object FileKey
- object Files extends FilesCompanionPlatform
- object Flag extends FlagCompanionApi
- object Flags extends FlagsCompanionPlatform with Serializable
- object Path extends PathCompanionApi
- object PosixFileAttributes
- object PosixPermission
- object PosixPermissions
- object ReadCursor extends ReadCursorCompanionPlatform with Serializable
- object Watcher
- object WriteCursor extends WriteCursorCompanionPlatform with Serializable
Deprecated Value Members
-
def
copy[F[_]](source: java.nio.file.Path, target: java.nio.file.Path, flags: Seq[CopyOption] = Seq.empty)(implicit arg0: Async[F]): F[java.nio.file.Path]
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.
- Annotations
- @deprecated
- Deprecated
(Since version 3.0.0) Use Files[F].copy
-
def
createDirectories[F[_]](path: java.nio.file.Path, flags: Seq[FileAttribute[_]] = Seq.empty)(implicit arg0: Async[F]): F[java.nio.file.Path]
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.
- Annotations
- @deprecated
- Deprecated
(Since version 3.0.0) Use Files[F].createDirectories
-
def
createDirectory[F[_]](path: java.nio.file.Path, flags: Seq[FileAttribute[_]] = Seq.empty)(implicit arg0: Async[F]): F[java.nio.file.Path]
Creates a new directory at the given path
Creates a new directory at the given path
- Annotations
- @deprecated
- Deprecated
(Since version 3.0.0) Use Files[F].createDirectory
-
def
delete[F[_]](path: java.nio.file.Path)(implicit arg0: Async[F]): F[Unit]
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.
- Annotations
- @deprecated
- Deprecated
(Since version 3.0.0) Use Files[F].delete
-
def
deleteDirectoryRecursively[F[_]](path: java.nio.file.Path, options: Set[FileVisitOption] = Set.empty)(implicit arg0: Async[F]): F[Unit]
Recursively delete a directory
Recursively delete a directory
- Annotations
- @deprecated
- Deprecated
(Since version 3.0.0) Use Files[F].deleteDirectoryRecursively
-
def
deleteIfExists[F[_]](path: java.nio.file.Path)(implicit arg0: Async[F]): F[Boolean]
Like
delete, but will not fail when the path doesn't exist.Like
delete, but will not fail when the path doesn't exist.- Annotations
- @deprecated
- Deprecated
(Since version 3.0.0) Use Files[F].deleteIfExists
-
def
directoryStream[F[_]](path: java.nio.file.Path, glob: String)(implicit arg0: Async[F]): Stream[F, java.nio.file.Path]
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.- Annotations
- @deprecated
- Deprecated
(Since version 3.0.0) Use Files[F].directoryStream
-
def
directoryStream[F[_]](path: java.nio.file.Path, filter: (java.nio.file.Path) ⇒ Boolean)(implicit arg0: Async[F]): Stream[F, java.nio.file.Path]
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.- Annotations
- @deprecated
- Deprecated
(Since version 3.0.0) Use Files[F].directoryStream
-
def
directoryStream[F[_]](path: java.nio.file.Path)(implicit arg0: Async[F]): Stream[F, java.nio.file.Path]
Creates a stream of
Paths inside a directory.Creates a stream of
Paths inside a directory.- Annotations
- @deprecated
- Deprecated
(Since version 3.0.0) Use Files[F].directoryStream
-
def
exists[F[_]](path: java.nio.file.Path, flags: Seq[LinkOption] = Seq.empty)(implicit arg0: Async[F]): F[Boolean]
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.
- Annotations
- @deprecated
- Deprecated
(Since version 3.0.0) Use Files[F].exists
-
def
move[F[_]](source: java.nio.file.Path, target: java.nio.file.Path, flags: Seq[CopyOption] = Seq.empty)(implicit arg0: Async[F]): F[java.nio.file.Path]
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.
- Annotations
- @deprecated
- Deprecated
(Since version 3.0.0) Use Files[F].move
-
def
permissions[F[_]](path: java.nio.file.Path, flags: Seq[LinkOption] = Seq.empty)(implicit arg0: Async[F]): F[Set[PosixFilePermission]]
Get file permissions as set of
PosixFilePermission.Get file permissions as set of
PosixFilePermission.This will only work for POSIX supporting file systems
- Annotations
- @deprecated
- Deprecated
(Since version 3.0.0) Use Files[F].permissions
-
def
readAll[F[_]](path: java.nio.file.Path, chunkSize: Int)(implicit arg0: Async[F]): Stream[F, Byte]
- Annotations
- @deprecated
- Deprecated
(Since version 3.0.0) Use Files[F].readAll
-
def
readRange[F[_]](path: java.nio.file.Path, chunkSize: Int, start: Long, end: Long)(implicit arg0: Async[F]): Stream[F, Byte]
Reads a range of data synchronously from the file at the specified
java.nio.file.Path.Reads a range of data synchronously from the file at the specified
java.nio.file.Path.startis inclusive,endis exclusive, so whenstartis 0 andendis 2, two bytes are read.- Annotations
- @deprecated
- Deprecated
(Since version 3.0.0) Use Files[F].readRange
-
def
setPermissions[F[_]](path: java.nio.file.Path, permissions: Set[PosixFilePermission])(implicit arg0: Async[F]): F[java.nio.file.Path]
Set file permissions from set of
PosixFilePermission.Set file permissions from set of
PosixFilePermission.This will only work for POSIX supporting file systems
- Annotations
- @deprecated
- Deprecated
(Since version 3.0.0) Use Files[F].setPermissions
-
def
size[F[_]](path: java.nio.file.Path)(implicit arg0: Async[F]): F[Long]
Returns the size of a file (in bytes).
Returns the size of a file (in bytes).
- Annotations
- @deprecated
- Deprecated
(Since version 3.0.0) Use Files[F].size
-
def
tail[F[_]](path: java.nio.file.Path, chunkSize: Int, offset: Long = 0L, pollDelay: FiniteDuration = 1.second)(implicit arg0: Async[F]): Stream[F, Byte]
Returns an infinite stream of data from the file at the specified path.
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
pollDurationfor 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.
- Annotations
- @deprecated
- Deprecated
(Since version 3.0.0) Use Files[F].tail
-
def
tempDirectoryResource[F[_]](dir: java.nio.file.Path, prefix: String = "", attributes: Seq[FileAttribute[_]] = Seq.empty)(implicit arg0: Async[F]): Resource[F, java.nio.file.Path]
Creates a resource containing the path of a temporary directory.
Creates a resource containing the path of a temporary directory.
The temporary directory is removed during the resource release.
- Annotations
- @deprecated
- Deprecated
(Since version 3.0.0) Use Files[F].tempDirectory
-
def
tempDirectoryStream[F[_]](dir: java.nio.file.Path, prefix: String = "", attributes: Seq[FileAttribute[_]] = Seq.empty)(implicit arg0: Async[F]): Stream[F, java.nio.file.Path]
Creates a stream containing the path of a temporary directory.
Creates a stream containing the path of a temporary directory.
The temporary directory is removed when the stream completes.
- Annotations
- @deprecated
- Deprecated
(Since version 3.0.0) Use Stream.resource(Files[F].tempDirectory(..))
-
def
tempFileResource[F[_]](dir: java.nio.file.Path, prefix: String = "", suffix: String = ".tmp", attributes: Seq[FileAttribute[_]] = Seq.empty)(implicit arg0: Async[F]): Resource[F, java.nio.file.Path]
Creates a resource containing the path of a temporary file.
Creates a resource containing the path of a temporary file.
The temporary file is removed during the resource release.
- Annotations
- @deprecated
- Deprecated
(Since version 3.0.0) Use Files[F].tempFile
-
def
tempFileStream[F[_]](dir: java.nio.file.Path, prefix: String = "", suffix: String = ".tmp", attributes: Seq[FileAttribute[_]] = Seq.empty)(implicit arg0: Async[F]): Stream[F, java.nio.file.Path]
Creates a stream containing the path of a temporary file.
Creates a stream containing the path of a temporary file.
The temporary file is removed when the stream completes.
- Annotations
- @deprecated
- Deprecated
(Since version 3.0.0) Use Stream.resource(Files[F].tempFile(..))
-
def
walk[F[_]](start: java.nio.file.Path, maxDepth: Int, options: Seq[FileVisitOption] = Seq.empty)(implicit arg0: Async[F]): Stream[F, java.nio.file.Path]
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.- Annotations
- @deprecated
- Deprecated
(Since version 3.0.0) Use Files[F].walk
-
def
walk[F[_]](start: java.nio.file.Path, options: Seq[FileVisitOption])(implicit arg0: Async[F]): Stream[F, java.nio.file.Path]
Creates a stream of
Paths contained in a given file tree, respecting the supplied options.Creates a stream of
Paths contained in a given file tree, respecting the supplied options. Depth is unlimited.- Annotations
- @deprecated
- Deprecated
(Since version 3.0.0) Use Files[F].walk
-
def
walk[F[_]](start: java.nio.file.Path)(implicit arg0: Async[F]): Stream[F, java.nio.file.Path]
Creates a stream of
Paths contained in a given file tree.Creates a stream of
Paths contained in a given file tree. Depth is unlimited.- Annotations
- @deprecated
- Deprecated
(Since version 3.0.0) Use Files[F].walk
-
def
watch[F[_]](path: java.nio.file.Path, types: Seq[EventType] = Nil, modifiers: Seq[Modifier] = Nil, pollTimeout: FiniteDuration = 1.second)(implicit F: Async[F]): Stream[F, Event]
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.
- Annotations
- @deprecated
- Deprecated
(Since version 3.0.0) Use Files[F].watch
-
def
watcher[F[_]](implicit F: Async[F]): Resource[F, io.Watcher[F]]
Creates a Watcher for the default file system.
Creates a Watcher for the default file system.
The watcher is returned as a resource. To use the watcher, lift the resource to a stream, watch or register 1 or more paths, and then return
watcher.events().- Annotations
- @deprecated
- Deprecated
(Since version 3.0.0) Use Files[F].watcher
-
def
writeAll[F[_]](path: java.nio.file.Path, flags: Seq[StandardOpenOption] = List(StandardOpenOption.CREATE))(implicit arg0: Async[F]): Pipe[F, Byte, INothing]
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
OpenOptionflags specified. By default, also adds the CREATE flag.- Annotations
- @deprecated
- Deprecated
(Since version 3.0.0) Use Files[F].writeAll
-
def
writeRotate[F[_]](computePath: F[java.nio.file.Path], limit: Long, flags: Seq[StandardOpenOption] = List(StandardOpenOption.CREATE))(implicit F: Async[F]): Pipe[F, Byte, INothing]
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
computePathoperation 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.- Annotations
- @deprecated
- Deprecated
(Since version 3.0.0) Use Files[F].writeRotate