fs2.io.file

package fs2.io.file

Type members

Classlikes

trait FileHandle[F[_]] extends FileHandlePlatform[F]

Provides the ability to read/write/lock/inspect a file in the effect F.

Provides the ability to read/write/lock/inspect a file in the effect F.

Companion
object
object FileHandle extends FileHandleCompanionPlatform
Companion
class
trait Files[F[_]] extends UnsealedReadFiles[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 F which has an Async[F] instance.

Companion
object
object Files
Companion
class
final case class ReadCursor[F[_]](file: FileHandle[F], offset: Long)

Associates a FileHandle with an offset in to the file.

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 extends ReadCursorCompanionPlatform
Companion
class
sealed trait ReadFiles[F[_]]

Platform-agnostic methods for reading files.

Platform-agnostic methods for reading files.

Companion
object
object ReadFiles extends ReadFilesCompanionPlatform
Companion
class
final case class WriteCursor[F[_]](file: FileHandle[F], offset: Long)

Associates a FileHandle with an offset in to the file.

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 extends WriteCursorCompanionPlatform
Companion
class

Types

type Path = Path

Value members

Deprecated methods

@deprecated("Use Files[F].copy", "3.0.0")
def copy[F[_]](source: Path, target: Path, flags: Seq[CopyOption])(implicit evidence$8: Async[F]): F[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.

Deprecated
@deprecated("Use Files[F].createDirectories", "3.0.0")
def createDirectories[F[_]](path: Path, flags: Seq[FileAttribute[_]])(implicit evidence$19: Async[F]): F[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.

Deprecated
@deprecated("Use Files[F].createDirectory", "3.0.0")
def createDirectory[F[_]](path: Path, flags: Seq[FileAttribute[_]])(implicit evidence$18: Async[F]): F[Path]

Creates a new directory at the given path

Creates a new directory at the given path

Deprecated
@deprecated("Use Files[F].delete", "3.0.0")
def delete[F[_]](path: Path)(implicit evidence$9: 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.

Deprecated
@deprecated("Use Files[F].deleteDirectoryRecursively", "3.0.0")
def deleteDirectoryRecursively[F[_]](path: Path, options: Set[FileVisitOption])(implicit evidence$11: Async[F]): F[Unit]

Recursively delete a directory

Recursively delete a directory

Deprecated
@deprecated("Use Files[F].deleteIfExists", "3.0.0")
def deleteIfExists[F[_]](path: Path)(implicit evidence$10: 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.

Deprecated
@deprecated("Use Files[F].directoryStream", "3.0.0")
def directoryStream[F[_]](path: Path)(implicit evidence$20: Async[F]): Stream[F, Path]

Creates a stream of Paths inside a directory.

Creates a stream of Paths inside a directory.

Deprecated
@deprecated("Use Files[F].directoryStream", "3.0.0")
def directoryStream[F[_]](path: Path, filter: Path => Boolean)(implicit evidence$21: Async[F]): Stream[F, 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.

Deprecated
@deprecated("Use Files[F].directoryStream", "3.0.0")
def directoryStream[F[_]](path: Path, glob: String)(implicit evidence$22: Async[F]): Stream[F, 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.

Deprecated
@deprecated("Use Files[F].exists", "3.0.0")
def exists[F[_]](path: Path, flags: Seq[LinkOption])(implicit evidence$5: 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.

Deprecated
@deprecated("Use Files[F].move", "3.0.0")
def move[F[_]](source: Path, target: Path, flags: Seq[CopyOption])(implicit evidence$13: Async[F]): F[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.

Deprecated
@deprecated("Use Files[F].permissions", "3.0.0")
def permissions[F[_]](path: Path, flags: Seq[LinkOption])(implicit evidence$6: 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

Deprecated
@deprecated("Use Files[F].readAll", "3.0.0")
def readAll[F[_]](path: Path, chunkSize: Int)(implicit evidence$1: Async[F]): Stream[F, Byte]
Deprecated
@deprecated("Use Files[F].readRange", "3.0.0")
def readRange[F[_]](path: Path, chunkSize: Int, start: Long, end: Long)(implicit evidence$2: Async[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.

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.

Deprecated
@deprecated("Use Files[F].setPermissions", "3.0.0")
def setPermissions[F[_]](path: Path, permissions: Set[PosixFilePermission])(implicit evidence$7: Async[F]): F[Path]

Set file permissions from set of PosixFilePermission.

Set file permissions from set of PosixFilePermission.

This will only work for POSIX supporting file systems

Deprecated
@deprecated("Use Files[F].size", "3.0.0")
def size[F[_]](path: Path)(implicit evidence$12: Async[F]): F[Long]

Returns the size of a file (in bytes).

Returns the size of a file (in bytes).

Deprecated
@deprecated("Use Files[F].tail", "3.0.0")
def tail[F[_]](path: Path, chunkSize: Int, offset: Long, pollDelay: FiniteDuration)(implicit evidence$3: Async[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.

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.

Deprecated
@deprecated("Use Files[F].tempDirectory", "3.0.0")
def tempDirectoryResource[F[_]](dir: Path, prefix: String, attributes: Seq[FileAttribute[_]])(implicit evidence$17: Async[F]): Resource[F, 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.

Deprecated
@deprecated("Use Stream.resource(Files[F].tempDirectory(..))", "3.0.0")
def tempDirectoryStream[F[_]](dir: Path, prefix: String, attributes: Seq[FileAttribute[_]])(implicit evidence$16: Async[F]): Stream[F, 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.

Deprecated
@deprecated("Use Files[F].tempFile", "3.0.0")
def tempFileResource[F[_]](dir: Path, prefix: String, suffix: String, attributes: Seq[FileAttribute[_]])(implicit evidence$15: Async[F]): Resource[F, 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.

Deprecated
@deprecated("Use Stream.resource(Files[F].tempFile(..))", "3.0.0")
def tempFileStream[F[_]](dir: Path, prefix: String, suffix: String, attributes: Seq[FileAttribute[_]])(implicit evidence$14: Async[F]): Stream[F, 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.

Deprecated
@deprecated("Use Files[F].walk", "3.0.0")
def walk[F[_]](start: Path)(implicit evidence$23: Async[F]): Stream[F, Path]

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.

Deprecated
@deprecated("Use Files[F].walk", "3.0.0")
def walk[F[_]](start: Path, options: Seq[FileVisitOption])(implicit evidence$24: Async[F]): Stream[F, Path]

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.

Deprecated
@deprecated("Use Files[F].walk", "3.0.0")
def walk[F[_]](start: Path, maxDepth: Int, options: Seq[FileVisitOption])(implicit evidence$25: Async[F]): Stream[F, 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.

Deprecated
@deprecated("Use Files[F].watch", "3.0.0")
def watch[F[_]](path: Path, types: Seq[EventType], modifiers: Seq[Modifier], pollTimeout: FiniteDuration)(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.

Deprecated
@deprecated("Use Files[F].watcher", "3.0.0")
def watcher[F[_]](implicit F: Async[F]): Resource[F, 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().

Deprecated
@deprecated("Use Files[F].writeAll", "3.0.0")
def writeAll[F[_]](path: Path, flags: Seq[StandardOpenOption])(implicit evidence$4: Async[F]): (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 OpenOption flags specified. By default, also adds the CREATE flag.

Deprecated
@deprecated("Use Files[F].writeRotate", "3.0.0")
def writeRotate[F[_]](computePath: F[Path], limit: Long, flags: Seq[StandardOpenOption])(implicit F: Async[F]): (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 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.

Deprecated