fs2.io.file

package fs2.io.file

Type members

Classlikes

trait FileHandle[F <: ([_$1] =>> Any)]
Provides the ability to read/write/lock/inspect a file in the effect F.
Companion
object
object FileHandle
Companion
class
final case class ReadCursor[F <: ([_$1] =>> Any)](file: FileHandle[F], offset: Long)
Associates a FileHandle with 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.
Companion
object
object ReadCursor
Companion
class
final case class WriteCursor[F <: ([_$1] =>> Any)](file: FileHandle[F], offset: Long)
Associates a FileHandle with 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.
Companion
object
object WriteCursor
Companion
class
@deprecated("Use ReadCursor/WriteCursor instead", "2.1.0")
object pulls
Provides various Pulls for working with files.

Value members

Methods

def copy[F <: ([_$12] =>> Any)](blocker: Blocker, source: Path, target: Path, flags: Seq[CopyOption])(evidence$22: Sync[F], evidence$23: ContextShift[F]): F[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.
def createDirectories[F <: ([_$24] =>> Any)](blocker: Blocker, path: Path, flags: Seq[FileAttribute[]])(evidence$44: Sync[F], evidence$45: ContextShift[F]): F[Path]
Creates a new directory at the given path and creates all nonexistent parent directories beforehand.
def createDirectory[F <: ([_$23] =>> Any)](blocker: Blocker, path: Path, flags: Seq[FileAttribute[]])(evidence$42: Sync[F], evidence$43: ContextShift[F]): F[Path]
Creates a new directory at the given path
def delete[F <: ([_$13] =>> Any)](blocker: Blocker, path: Path)(evidence$24: Sync[F], evidence$25: ContextShift[F]): F[Unit]
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.
def deleteDirectoryRecursively[F <: ([_$15] =>> Any)](blocker: Blocker, path: Path, options: Set[FileVisitOption])(evidence$28: Sync[F], evidence$29: ContextShift[F]): F[Unit]
Recursively delete a directory
def deleteIfExists[F <: ([_$14] =>> Any)](blocker: Blocker, path: Path)(evidence$26: Sync[F], evidence$27: ContextShift[F]): F[Boolean]
Like delete, but will not fail when the path doesn't exist.
def directoryStream[F <: ([_$25] =>> Any)](blocker: Blocker, path: Path)(evidence$46: Sync[F], evidence$47: ContextShift[F]): Stream[F, Path]
Creates a stream of Paths inside a directory.
def directoryStream[F <: ([_$27] =>> Any)](blocker: Blocker, path: Path, filter: Path => Boolean)(evidence$48: Sync[F], evidence$49: ContextShift[F]): Stream[F, Path]
Creates a stream of Paths inside a directory, filtering the results by the given predicate.
def directoryStream[F <: ([_$29] =>> Any)](blocker: Blocker, path: Path, glob: String)(evidence$50: Sync[F], evidence$51: ContextShift[F]): Stream[F, Path]
Creates a stream of Paths inside a directory which match the given glob.
def exists[F <: ([_$9] =>> Any)](blocker: Blocker, path: Path, flags: Seq[LinkOption])(evidence$16: Sync[F], evidence$17: ContextShift[F]): F[Boolean]
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.
def move[F <: ([_$17] =>> Any)](blocker: Blocker, source: Path, target: Path, flags: Seq[CopyOption])(evidence$32: Sync[F], evidence$33: ContextShift[F]): F[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.
def permissions[F <: ([_$10] =>> Any)](blocker: Blocker, path: Path, flags: Seq[LinkOption])(evidence$18: Sync[F], evidence$19: ContextShift[F]): F[Set[PosixFilePermission]]
Get file permissions as set of PosixFilePermission
This will only work for POSIX supporting file systems
def readAll[F <: ([_$1] =>> Any)](path: Path, blocker: Blocker, chunkSize: Int)(evidence$1: Sync[F], evidence$2: ContextShift[F]): Stream[F, Byte]
Reads all data synchronously from the file at the specified java.nio.file.Path.
def readRange[F <: ([_$2] =>> Any)](path: Path, blocker: Blocker, chunkSize: Int, start: Long, end: Long)(evidence$3: Sync[F], evidence$4: ContextShift[F]): Stream[F, Byte]
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.
def setPermissions[F <: ([_$11] =>> Any)](blocker: Blocker, path: Path, permissions: Set[PosixFilePermission])(evidence$20: Sync[F], evidence$21: ContextShift[F]): F[Path]
Set file permissions from set of PosixFilePermission
This will only work for POSIX supporting file systems
def size[F <: ([_$16] =>> Any)](blocker: Blocker, path: Path)(evidence$30: Sync[F], evidence$31: ContextShift[F]): F[Long]
Returns the size of a file (in bytes).
def tail[F <: ([_$3] =>> Any)](path: Path, blocker: Blocker, chunkSize: Int, offset: Long, pollDelay: FiniteDuration)(evidence$5: Sync[F], evidence$6: ContextShift[F], evidence$7: Timer[F]): Stream[F, Byte]
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.
def tempDirectoryResource[F <: ([_$22] =>> Any)](blocker: Blocker, dir: Path, prefix: String, attributes: Seq[FileAttribute[]])(evidence$40: Sync[F], evidence$41: ContextShift[F]): Resource[F, Path]
Creates a resource containing the path of a temporary directory.
The temporary directory is removed during the resource release.
def tempDirectoryStream[F <: ([_$21] =>> Any)](blocker: Blocker, dir: Path, prefix: String, attributes: Seq[FileAttribute[]])(evidence$38: Sync[F], evidence$39: ContextShift[F]): Stream[F, Path]
Creates a stream containing the path of a temporary directory.
The temporary directory is removed when the stream completes.
def tempFileResource[F <: ([_$19] =>> Any)](blocker: Blocker, dir: Path, prefix: String, suffix: String, attributes: Seq[FileAttribute[]])(evidence$36: Sync[F], evidence$37: ContextShift[F]): Resource[F, Path]
Creates a resource containing the path of a temporary file.
The temporary file is removed during the resource release.
def tempFileStream[F <: ([_$18] =>> Any)](blocker: Blocker, dir: Path, prefix: String, suffix: String, attributes: Seq[FileAttribute[]])(evidence$34: Sync[F], evidence$35: ContextShift[F]): Stream[F, Path]
Creates a stream containing the path of a temporary file.
The temporary file is removed when the stream completes.
def walk[F <: ([_$31] =>> Any)](blocker: Blocker, start: Path)(evidence$52: Sync[F], evidence$53: ContextShift[F]): Stream[F, Path]
Creates a stream of Paths contained in a given file tree. Depth is unlimited.
def walk[F <: ([_$32] =>> Any)](blocker: Blocker, start: Path, options: Seq[FileVisitOption])(evidence$54: Sync[F], evidence$55: ContextShift[F]): Stream[F, Path]
Creates a stream of Paths contained in a given file tree, respecting the supplied options. Depth is unlimited.
def walk[F <: ([_$33] =>> Any)](blocker: Blocker, start: Path, maxDepth: Int, options: Seq[FileVisitOption])(evidence$56: Sync[F], evidence$57: ContextShift[F]): Stream[F, Path]
Creates a stream of Paths contained in a given file tree down to a given depth.
def watch[F <: ([_$8] =>> Any)](blocker: Blocker, path: Path, types: Seq[EventType], modifiers: Seq[Modifier], pollTimeout: FiniteDuration)(evidence$14: Concurrent[F], evidence$15: ContextShift[F]): Stream[F, Event]
Watches a single path.
Alias for creating a watcher and watching the supplied path, releasing the watcher when the resulting stream is finalized.
def watcher[F <: ([_$7] =>> Any)](blocker: Blocker)(evidence$12: Concurrent[F], evidence$13: ContextShift[F]): Resource[F, Watcher[F]]
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().
def writeAll[F <: ([_$4] =>> Any)](path: Path, blocker: Blocker, flags: Seq[StandardOpenOption])(evidence$8: Sync[F], evidence$9: ContextShift[F]): (F, Byte) => Unit
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.
def writeRotate[F <: ([_$6] =>> Any)](computePath: F[Path], limit: Long, blocker: Blocker, flags: Seq[StandardOpenOption])(evidence$10: Concurrent[F], evidence$11: ContextShift[F]): (F, Byte) => Unit
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.